Tuesday, July 21, 2009

Custom windows using .NET 2.0 and the WinAPI

menu.png

Introduction

This article shows how to create custom windows using GDI+.

Background

Some time ago, I had a task to create a menu for the MS PPTViewer application that allows the user to switch slides using menu items. I decided to create a menu using the WinAPI function "UpdateLayeredWindow" from the User32.dll library. This functions allow to draw any 32-bit image on the screen. For this menu, I implemented a library that I want to share.

Using the code

To create a custom window, you should inherit the TransparetWindow class and override the DrawPolygons method. This method should return a collection of IPolygons. This is done in order to draw the polygons after all the calculations.


See full detail: http://www.codeproject.com/KB/dialog/custom_windows.aspx

No comments: