Sunday, December 26, 2010

Metro UI (Zune like) interface (form)

zuneui.jpg

Introduction
The future of Windows Interfaces is probably the Zune-like ones, with a borderless form and some controls inside of it. The problem is: if you're using WindowsForm, creating that borderless form with shadows and resizing stuff's aren't as easy as it seems. This arcticle will show you how to create those forms using a bit of DWM and some other Windows Api's.

Background
To create the desired effect, we will need to extend the non-client area, cut off the Aero's glass from the Window, and handle some resizing and moving events. Luckly, José Mendez shown us on his arcticle how to do some of these stuffs.
Of course, "the non-client area trick" only works if Aero is turned on. But i've handled it on my code. Let's take a look:

Using the code
I've tried to create a Form for you to inherit it, making easy for you to use my code. Unluckly, the resize thing must be changed if you want to extend that funcionality into a panel or some other control. So I prefered to give my code for you to add it inside your own form.

Read more: Codeproject