Welcome Guest!
Create Account | Login
Locator+ Code:

Search:
FTPOnline
Channels Hot Topics Partner Sites Magazines About FTP RSS 2.0 Feed



email article
printer friendly
get the code
more resources

Spice Up Your Windows Forms
Use popup-style windows, irregularly shaped forms, and collapsible and dockable controls to give users the flexible, modern, consistent UIs they've come to expect.
by Andrew Flick and Jason Beres

September 13, 2004

Technology Toolbox: VB.NET, C#, .NET Framework

Today's users are more demanding—they expect to find Microsoft Office application features, such as popup-style windows, irregularly shaped forms, and collapsible and dockable controls, in a robust application. In this article, we'll show you the basics of how to implement three features that can make or break the UI of your next Windows Forms application.

ADVERTISEMENT

Windows Forms typically follow a set design that is rarely compromised; that is, they are square. Creating irregularly shaped forms under a non-.NET environment is difficult to say the least. Fortunately, the .NET Framework provides a simple and easy-to-use API that improves your forms' functionality and spices them up.

As with any good visual element, misusing irregularly shaped forms can detract from the professionalism of the end product. Two reasons for using an irregularly shaped form come to mind. The first is functionality. Irregularly shaped forms are a good choice if they highlight key controls, improve the end user's experience, and achieve greater functionality. For instance, Windows Media Player is a prime example of an irregularly shaped form that's defined by functionality. The internal presentation of data is essentially in a box; however, key controls, such as the media components, are highlighted and appear outside the box.

The second reason has to do with presentation. Design can be as simple as providing the rounded corners to a Windows Form, à la MSN Messenger, or creating a splash screen that demonstrates a company's technological prowess. When presentation is the determining factor for employing an irregularly shaped form, exercise good taste and, if possible, consult a design team.

Develop an Irregularly Shaped Form
The first step to designing an irregularly shaped form is determining which of the two uses—functionality or presentation—you'll employ. Be sure to use a high-quality image as the background for the form. Neglecting to do so might hinder Windows' capability to paint the shape later. For example, let's say you're using an irregularly shaped form for presentation and are modeling the application after the look and feel of MSN Messenger 6.2.

Cut out the rounded shape of the form you want to use in the application, then choose a background color for the image. Choose this color wisely. It will be used as the TransparencyKey property for the form that this image will live on. This means that every area of the form where the background color is the same as the color of the image background will be transparent as well. That is why choosing an oddball color such as lime or hot pink is a smart idea. You can do this in Microsoft Paint (see Figure 1).




Back to top















Java Pro | Visual Studio Magazine | Windows Server System Magazine
.NET Magazine | Enterprise Architect | XML & Web Services Magazine
| | Discussions | Newsletters | FTP Home