Essentially, with this component, you will be able to build heavily customized custom title bar / custom caption bar / custom border form based applications for Winforms!
ModernChromeWindow .NET is a highly customizable WinForms .NET Form window component that lets you present your WinForms .NET application window(s) in a variety of modern looking Window styles – i.e. Microsoft Office, Windows 8, and WinRT, and even in a custom style of your own by simply supplying your own values for various properties that the component exposes.
Why Would I Use It?
If you wanted to move away from using the traditional looking Windows Form user-interface, and wanted your applications to have a modern look-and-feel, and at the same time you do not want to handle the complex low-level non-client area Win32 messages yourself, then you would want to use this component.
Essentially, with this component, you will be able to build heavily customized custom title bar / custom caption bar / custom border form based applications for Winforms, without you having to deal with the various complex low-level Win32 (non-client area) messages.
How It Works?
This component inherits from the standard .NET Form class, and makes it border-less, and draws all of its non-client sections of its UI on its own.
In this process, the component also exposes a variety of simple to set CLR properties that it uses to draw and style the Window chrome, so that you can customize it the way you want it to look, in addition to keeping the standard behaviors of the WinForms .NET Form class.
The component provides a set of themes right out-of-the-box, ready to use, with the likes of Microsoft Office (with various color themes as well), Win8 & WinRT (a.k.a Metro) styles.
1. Ability to host .NET controls on the title bar section
You can even host custom controls on the title bar section (non-client area) if you want, by simply adding controls through a simple property in the component.
2. Advanced option: Custom draw the Window Chrome on your own
The component also exposes an interface IModernWindowChromeProvider which you can implement to provide your own custom drawing of the chrome - i.e. the Border and the title bar contents - all by your own code, without worrying about handling the nuances of the complex Win32 non-client area messages.
In fact, when using this interface, you would not even know that you are actually responding to the window's non-client area Win32 messages.
This custom interface also provides some special methods that will be called when some specific non-client Windows messages are executed, so you can add any custom code that you want executed at that time.
Component Features In Detail
1. Simple to use
Simply derive from the ModernChromeWindow class instead of the standard .NET Form class, and you are ready to go
This will render the default customization pre-defined in the component - i.e. one of the built-in themes, viz., Office Black.
Of course, you can always set up your own advanced customization on top of what comes built-in.
Since the component derives from Form class and keeps all of its standard behavior and provides additional behaviors on top (i.e. Sizing, Moving, etc.) the change to your code is only a one Word change - i.e replace Form with ModernChromeWindow class.
2. Full Visual Studio design-time support
The component supports the Visual studio IDE design-time, so that it displays the non-client area (rendering and its behavior) as-is in the designer view.
So, as you customize the property values of the component when in design time mode, you will see it appear in the view, so you can experience the full WYSIWYG feature.
3. True non-client area drawing
The component draws into the real non-client area by making the appropriate calls into the Operating system to inform it of the intended non-client area that the system should honor as non-client area.
In other words, it does not simply fake by drawing something that looks like a non-client area in your Form client area, but rather actually provides you a real non-client area.
The component paints the real non-client area, by doing all the heavy-lifting of managing and responding to all relevant non-client area Win32 messages, and lets you simply set properties to help draw the chrome as you like.
In fact, if you use the advanced feature of custom implementing our IModernWindowChromeProvider interface, you will be able to completely custom paint the non-client area yourself (with as much ease as if you were painting the client area), and be able to respond to mouse messages / activities as well.
4. Works in all mainstream Windows Operating systems: No dependency on OS theme specific libraries such as uxtheme.dll, etc.
The component is completely custom written in order to provide (out-of-the-box) customizable drawing of the non-client areas, and hence there is no direct dependency on any OS theme specific libraries such as uxtheme.dll.
This means that you can use this library to present cool window forms applications with heavily customized non-client areas as you wish, across any Windows Operating system, including Windows XP, Vista, Windows 2003, Windows 2008, Windows 7 and Windows 8.
5. No complex style editors or skinning involved
The customization provided by the component does not involve any kind of complex styling or skinning (or skin files) to be created.
All you need to do is either use the built-in drawing themes (like MS Office, WinRT, etc.) or provide your own values for the customization, just simply by setting simple properties of the component in code or at design-time (via properties editor), just like the way you are normally used to with other standard .NET controls.
6. Sizing and moving behavior supported
Although the component by default makes the FormWindowState to Borderless window (thereby removing the standard Moving & Sizing behaviors provided by WinForms .NET Form class), the component provides its own custom implementation for sizing and moving the form window.
7. Out-of-the-box support for ready-to-use Window rendering themes
The component provides out-of-the box the following styled Window chrome rendering themes ready to use:
8. Custom Theme supported
Also available in the component, is a theme named “Custom”, that lets you customize many aspects of the application window chrome rendering and create your own theme for your application, just by simply setting up some CLR properties.
9. Hosting .NET controls on the title bar section
The component exposes a simple property that allows you to add any .NET control (standard .NET or even custom .NET controls) to be hosted on the non-client area / title bar area.
You can even specify exactly where in the title bar (in client co-ordinates) that the child control(s) should be rendered.
Your user can interact with these controls (on the title bar) as though they were hosted on the client area of the form.
A screen-shot of the ModernChromeWindow form instance in action, where its title bar (non-client area) is set up to host some .NET controls on it
10. Supports plugging-in your own custom chrome drawing and behavior provider
In addition to the very rich feature of being able to host custom .NET controls on the non-client area (title bar section) as detailed in the point above, the control also lets you to completely draw the window's chrome all by yourself.
Note that you need not use this advanced feature if you simply looking to host some .NET controls on the title bar, since in that scenario you can simply set up those controls through a simple CLR style property on the component.
But if you wanted to take control of painting the full window's chrome by yourself, you could do so by using an additional rich mechanism as detailed below.
The component exposes an interface IModernWindowChromeProvider which you can implement to provide your own custom drawing of the chrome - i.e. the Border and the title bar contents - all by your own code, without worrying about handling the nuances of the complex Win32 non-client area messages.
A sample custom window drawn by implementing the interface IModernWindowChromeProvider, and being able to draw custom controls on the non-client area of the window:
11. Supports transparent background rendering of non-client areas
By setting up some simple Boolean properties, you can specify whether to draw the non-client area i.e. the title bar and / or the border, with their background drawn as transparent.
You can choose to either draw transparently the title bar only or even both title bar and the border.
The component also provides an additional property whereby you can set up the title bar text foreground brush so that the component can use it to draw the title text with that brush, specifically when you have asked it to draw the title bar background as transparent.
12. Customizable border rendering
This feature allows you to customize:
13. Customize the Application Chrome Title bar height
With this feature, you can set the Non-client area / title bar section to any height that you desire - i.e. to a more larger or smaller than the standard 32-pixels unit height of Title bar area by simply setting the title bar height property.
14. Customize the Application Chrome Title bar background brush
With this feature, using some simple properties, you can set the brush (i.e. solid, linear gradient, texture, image brush etc.), brush color, and the gradient mode (if need be), to draw the title bar section of the non-client area of the window.
Note that, by default the title bar and the border of the chrome are drawn using the same color. But if you need, you could set two separate colors, one for drawing the window border and the other one for drawing the title bar background.
15. Render custom sized Application Icon
By setting a property, you can host a larger sized icon if your application has such a need. You could think of using this feature by increasing the Title bar area of the non-client area height, and could have a need to draw a larger sized Application icon at the left hand corner of the non-client area chrome.
Aside this, you can also set a property to specify whether the app icon should be drawn or not. This could be useful to change the visibility of the icon at run-time.
16. Customize the application chrome command buttons for:
Different colors customizations for the command buttons
Different size customizations for the command buttons
17. Customize Window Chrome command buttons images
A couple of options are available with this feature: Either you can...
18. Customize Window Chrome command buttons location in the chrome
By setting a simple margin property, you can set the location of where the command buttons will appear in the chrome.
19. Customize Window Chrome command buttons visibility / availability
By setting a simple property, you can switch off the visibility of the Minimize, maximize / restore and Close buttons completely.
For example, in one scenario, you could simply switch off displaying the minimize and maximize/restore buttons and show only the Close command button, or switch off all of these buttons visibility completely.
20. Provides system commands context menu, and support for custom Context menu
The component provides built-in mechanism to display system menu when your users right-click on the title bar area or the Application’s Task bar button (Right-click in earlier windows, and Shift + Right-click in Window Vista upwards)
You can also set up your custom context menu instance and supply that as the one that the control should display when the user right-clicks on the title bar or the app’s task bar button.
21. Window edges / corners customization
The component allows you to specify how the window’s edges should be drawn – i.e. with curved edges or sharp rectangular corners. This can be done by setting a custom value to the curve edge radius value exposing property of the class.
22. Supports (optionally) rendering as a chrome-less window, but keeping it sizable
The component also supports rendering the Form window instance without its chrome - i.e. it will draw its border (with a customized border size if need be), but with no title bar and no window command buttons on it and no way to move the window, but allowing the window to be re-sized.
23. Custom implementation for enabling Windows + <key> hot keys
The control features automatic / built-in support for many of Windows + Hot key(s) global hook.
Hot keys automatically supported
The control has built-in support for many of the “Windows” hot keys (global) viz.,
Automatic “attaching” and “detaching” of Global hot keys
The implementations automatically detects the window’s active/non-active status accordingly attaches and detaches to the internal global hook with the Operating system, so that when the window is not active, the hooks are not currently in force and hence the user can use it normally with other processes or the window OS itself.
Advanced docking features with Windows Desktop
When performing the Window docking in the desktop, the control will perform advanced calculations to support automatic cycling and docking scenarios, viz.,
The control has custom implementation for keyboard based multi-monitor window movements & sizing for handling the following keys:
The control will automatically detect available attached monitors, and move the window between them.
Automatic Cycling while keys are kept pressed
If the users keep the hot keys pressed, the control will automatically cycle the window movements for all of the supported Windows + * hot keys
“Desktop peek” feature supported
In addition to the above hot keys, this control also has support for automatically performing Aero “Desktop peek” (Windows + <Spacebar> in Win 7, or Windows + <comma> in Windows 8.0 / 8.1) when the control is used in OS versions Windows 7 and upwards.
Ease of enabling the Windows Global Hooks feature
The way you enable the window to have the new Windows hot key features is via a simple bool property ShouldEnableWindowsKeyHooks.
Depending on this property value setting, the control will automatically do all the heavy-lifting to deliver the features.
24. Setup gap between chrome window command buttons
You can ask the control to setup gap between chrome window command buttons - i.e. a deterministic gap between the Minimize, Maximize / restore and Close buttons on the title bar area
25. Specify a custom text alignment for your window title-bar text
You can set up a custom chosen text alignment for the window title-bar text as you desire, say for example: Left, Center or Right, by setting a simple property.
This property also allows setting up a custom string-format settings (text trimming, format-flags, etc.) of your choice to use, when formatting the text for the title-bar.
26. Many more features supported, including, being able to...