I had to change the color and icon of the title bar, so I used custom window. But in this way, I have to create my own window control buttons(minimize, maximize, restore, close). I want to use the native ones like the thing that Microsoft Office and Google Chrome did. How should I do?
Office
Chrome
There is no easy way to just use the default chrome buttons as-is in a custom window I am afraid.
But you could quite easily create your own ones using the Segoe MDL2 Assets font:
What is the font family of the close/minimize/reduce button in Windows 10?
Show default window buttons on WPF Window using WindowChrome
Related
I have a window application that has a window form. I have to change this window form header text (Font Size and Font family etc). I am unable to do this. I am attaching an image for better understanding.
You can do this via the Style Libraries in the Custom Border Form project on CodePlex.
There are currently three skins available: Longhorn, Vista, and WMP. There are some demo usages as well on the site.
Alternatively there is also WinForms SkinFramework available on CodeProject.
The problem lies in the fact that WinForms is a managed wrapper around the native Windows UI elements. So the font and other styling is ultimately controlled via the Operating System theme (Aero in this case).
I want to add an icon to the WPF window titlebar, but my icon is a bit wider than the fixed size of the icons accepted by the titlebar (16x16) Is there any way to add a wider icon to the titlebar?
This is not possible, because Windows handles the standard window chrome. You have to do a custom window and replace the chrome. For example this or look at this.
Currently my WPF apps have the "unknown document" type of icons. I don't want to design icons for each but something like the default icon for Winform apps would be very good.
You have to set the windows icon for each window (or at least for your main window). This is the icon that is shown in the windows title and in task-manager. Be aware that the window icon should not be an .ico-file having huge resolution icons, else it will fail on windows XP. You can also use a png-file.
<Window
...
Icon="/Assembly;component/imagePath/yourImage.png"
Title="Window Title"...>
The other icon is the icon in the projects properties page. This icon is used as the file icon. You must use an .ico-file. However for this, you can use also highres icon-files (for showing huge icons in Vista+ -explorer).
I see that many applications do not have a title bar, but still have the window controls in the upper right corner. These are also styled differently than the normal windows form controls. Is it possible to achieve this effect in WPF?
Here are some examples:
Zune Desktop software:
http://i548.photobucket.com/albums/ii356/elpedrogrande/btns2.gif
Photoshop:
http://i548.photobucket.com/albums/ii356/elpedrogrande/btns3.gif
GoTo Assist:
http://i548.photobucket.com/albums/ii356/elpedrogrande/btns1.gif
They do this by setting the window style bits so it is created without a title bar. And then draw their own, making it look like a custom one. Which is the main reason that all these programs have caption glyphs that are not identical.
You'd accomplish the same in WPF by setting the WindowStyle to None. And a whole bunch of code to get back the behavior that Windows implements automatically with the title bar. Google "WM_NCHITTEST" to find out more.
I am working on .NET 2.0 with C#. I am using Form Border Style as "FixedToolWindow".
I am not able to add icon with this property.
Is it possible to add icon with this property? If so, give me a solution.
Tool windows don't use icons.
For a similar style, you could set the window style to FixedSingle and disable the Min/Max buttons instead.
No. Windows does not draw an icon for FixedToolWindow. There are other options including drawing your own window, but that could be tedious.