Apply Windows XP Control Styles

Problem

You want your controls to have the updated Windows XP appearance on Windows XP systems.

Solution

In .NET 1.0, you must create a manifest file. In .NET 1.1, you simply need to call the Application.EnableVisualStyles method.

Discussion

Windows XP styles are automatically applied to the non-client area of a form (such as the border and the minimize and maximize buttons). However, they won’t be applied to controls such as buttons and group boxes unless you take additional steps.

First of all, you must configure all your form’s button-style controls (such as buttons, check boxes, and radio buttons). These controls provide a FlatStyle property, which must be set to System.

The next step depends on the version of .NET ...

Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.