O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required