Make ToolBar look like Windows Vista/7 instead of classic - c#

I want to make my application look more like a native app than a .NET app and I use .NET because of Visual Designer and C#.
I've seen some native apps using a toolbar that looks very similar to Vista/7 menus.
Check out the example:
Some native apps like Notepad++, Codeblocks, etc. uses the same Vista/7 style for toolbars. How can I do the same in C#? I know P/Invoke, so, I need to know the methods to be used or an example.
I don't use ToolBarStrip, I use ToolBar because of the nativeness. What P/Invoke can I use for make the Toolbar look like the above image (Vista/7 look)?
EDIT: Based on this question, I need to do the same in P/Invoke instead of Win32.

Notepad++ uses both versions of the native toolbar controls in its source code. I'd assume it chooses between the two based on the Windows version. You already tried the .NET wrapper for the legacy one (ToolBar class) so that's probably not the one you like.
The other one is the more recent Rebar control, also known as "Coolbar". Beware that its look-and-feel depends on the Windows version so don't go off the (dated) screenshots in the linked MSDN article. There is no official .NET wrapper for it, but programmers has written some. There is a Codeproject.com project that proposes one, I don't normally recommend any such projects but you sound quite capable of getting the bugs out.

I see that the windows vista toolbar has fade settings applied which is easier to do with brushes in Xaml.
However here is a downloadable theme in codeproject that you can reference on how it is done there.
https://www.codeproject.com/Articles/18858/Fully-themed-Windows-Vista-Controls

Related

WPF- How to Make Menu control look native

I am currently learning WPF framework; I have some past (not much though) experience with Winforms. One problem I've had in both is that the menubar does not look native. I've found a workaround in Winforms, but I haven't been able to find anything for WPF. I've not had this problem in other frameworks I've used, particularly Qt.
In many pics I've seen, it looks native enough in Windows 7, but not Windows 10. I included some pics.
How it currently looks:
How it should look:
Thanks in advance!
Edit
While I have not seen the possible duplicate link, I am aware of setting the foreground/background on WPF controls. That link doesn't really answer my question. I don't want to come up with my own style at this point; all I want to do is make controls look native.
If custom styling is the only way, that's fine, but if there is another way, that would be preferable.
Thanks!
I don't think there's a quick fix to get what you want. WPF renders using DirectX, allowing for much more flexibility in styling applications. A WPF app should render exactly the same way on any version of Windows - it will not automatically adopt a native look and feel (that was actually one of the main selling points of the technology in its early days).
While MS made the default styling somewhat close to Windows at the time of release (Vista, I think?), if you want WPF controls to have a particular look you're going to have to style them yourself.

C# Charting Library

I've been looking for a good cross-platform charting library to use on a .NET project intended to be run on both Windows and Linux, but everything looks to have a dependency on WinForms controls, seemingly including ZedGraph (not to mention that ZedGraph looks a bit, well, dated).
Microsoft's Chart Controls for WinForms/ASP.NET look great, but like I said, have a dependency on WinForms controls. I know Mono includes WinForms support for Linux, but I'd rather not have to have Linux end-users install WinForms for what's going to end up being a GTK# application.
Does anyone know of any .NET charting library out there that don't depend on WinForms and that has good visual appeal?
P.S. As an example of a nice visual style, on a different PHP-based project, we use pChart (which I would link, but I don't have enough rep for it).
P.P.S. I've thought about using the Google Chart API, but I don't want to require a network connection just to generate charts.
They require Windows.Forms, since GDI (graphics) functions reside in that particular library. Any other chart control will have to use either 3rd party library or provide its own graphics toolkit.
The best thing I could find is Apache FOP:
http://xmlgraphics.apache.org/fop/
You should be able to run it from command line, or integrate it using IKVM.
Finally, why don't you want Windows.Forms library? As far as I know, mono provides a sufficiently working one.

How to build UIs like skype

I want to know how can I build UIs like skype using standard .Net/C#. Is it possible at all?
Thanks
You can use Windows Presentation Foundation to build more stylish GUIs than Windows Forms. It's pretty difficult to move from Forms to WPF. You usually need a good design tool, like Expression Blend.
AFAIK skype was built using Qt4, it's rather easy to build custom gui widgets, check
C++ GUI Programming with Qt4, 2nd Edition and this tutorial.
P.S. check this to see how to build qt4 on windows using MSVC 2008.
It might be possible to build such an UI using Windows Forms, but only with a lot of custom control code or a really good component suite. But as Chris said, WPF should be the tool of your choice when you want to use .NET.
Qt4 is a really powerful C++ framework, also powering apps like Google Earth. The Qt SDK, inclduing everything you need to get started (Compiler, IDE, documentation), can be obtained here. It's licensed (among others) under the LGPL.
Windows Presentation Foundation will give you the most flexibility, but it can be hard to use. An alternative to this is Sliverlight - Version 3 is going to be capable of being used outside of the browser (similar to Adobe Air), and in some ways provides an easier development experience. You might want to consider using some third party controls to give you access to nice functionality that you wouldn't get out of box.
To my acknowledge Skype is build with Delphi an a set of third party tools, so it for sure can be done without WPF.
Take a look at the components from DevExpress or TMS.

How do I give professional look and feel to my .NET windows application?

I'm using WINFORMS not WPF.
I just know basic c# .net gui programming. I donot want the traditional windows look. I want to have my own custom look (eg. gtalk, antivirus softwares, media players, google chrome).
Actually I'm inspired by google's PICASA software. Its awesome. I want to do something like that.How can I do that? If there is something I should learn please point me.
Also I may have to write my own custom controls (like modified tree view etc..) I guess. Please give some good learning resources.
This article describes how to draw custom windows. The author also shows how to draw non-rectangular windows.
If you could use WPF instead of Windows Forms, this is a good article about customizing window drawing:
http://www.codeguru.com/csharp/.net/net_wpf/article.php/c16379/
There is also a question with some good answers here on SO:
Creating custom forms in WPF?
Update:
I think that skinning and custom drawing is fun to do from a programmers perspective, but I also think that there is almost no benefit for the user.
The creators of the platform you are developing for might have put a lot of effort into the design of their windowing toolkits.
If you just want to change some visual aspects of your application you also should take into account that you might miss some important other aspects of UI design:
consistency
accessibility
aesthetics (if you are overdoing
effects, gradients, ...)
internationalization
...
As you are developing for Windows, you also lose the skinning ability of the OS itself. And I think that some of the skins that come with newer versions of Windows are pretty good.
You can try any of the following:
telerik
Syncfusion
(source: componentsource.co.jp)
Or other components.
They do make your UI pretty.
Edit: if you want to study how they do it, you can buy the source code-- along with documentation and understand from there.
There are some commercial control libraries available.
I can recommend the Krypton Suite. It consists of the free Krypton Toolkit (which contains a lot of skinnable controls) and other non-free controls (Navigator, Ribbon, Docking, Workspace). It has some built-in palettes and renderers that allow you to make your UI look like Office 2010, Office 2007, Office 2003, ...
You want to look for +winforms +skinning. I haven't tried these, but the first hits don't look bad. Most decent skinning tools will be paid for.
From what you said, you want to develop your own custom controls. You have some frameworks for this like Qt which can use Direct3D for hardware accelerated graphics. It also have a Visual Studio plugin. There is a free LGPL version and a commercial version of it.
I remembered about Qt because you mentioned Picasa and as far as I remember, I heard the Picasa UI has been written through Qt.
You can try using "SetWindowRgn(..)" to set an arbitrary region for your window. This may range from giving a rounded rectangle shape to giving a weird looking shape to the form!
Check this out: Link.
There is another option if you are working in Vista(aero enabled), ie you can check out DwmExtendFrameIntoClientArea(..) function here: link text
You can set the form's border style to 'none' and go on to create your custom form! You then might have to create custom buttons to carry out tasks like close, minimise, maximise etc. You might even need to write code for drag and drop events..
For the background, you might need to have a look at the gradient fills to give a great effect, otherwise you can use great looking pictures as Background..! But the latter option isnt good unless you have really good pic.

How to read installer shortcuts with C# (WPF)

Background: I've decided to teach myself C# through WPF, and I'm writing a small application that needs to get a list of Start Menu shortcuts and their targets and store them. Basically, I'm trying to take all the shortcuts and put their target applications' paths into memory. However, I've run into a problem trying to read Windows Installer shortcuts (the ones that point to something like C:\Windows\Installer\{90120000-0030-0000-0000-0000000FF1CE}\wordicon.exe -- Microsoft Office is a good example of this). I did some research and it seems that Windows uses some behind-the-scenes magic involving the Registry to find the actual location of the file.
Question: How can I get the actual target of these Windows Installer shortcuts in C#? A lot of sources I've found point me to the IShellLink interface, but I don't know how to use it with C#. I'd prefer to use Windows API calls (or, even better, a .NET library) instead of manually looking through the Registry, but I'll take any guidance on the issue.
After doing more research, I found an easy answer here. It's basically using a combination of the MsiGetShortcutTarget and MsiGetComponentPath functions of msi.dll.
I'm afraid IShellLink IS the Windows API for using shell links! The Shell API is heavily COM-based.
But the good news is that COM interop works very well in .NET. This site is usually a very good resource:
http://www.pinvoke.net/default.aspx/Interfaces/IShellLinkA.html

Categories

Resources