Export (0) Print
Expand All

How to: Enable Windows XP Visual Styles

Visual styles are specifications for the appearance of controls. For example, visual styles can define the color, size, and font of controls. They enable you to configure the visual interface to coordinate with your application interface. Additionally, they provide a mechanism for applying visual styles to all Windows-based applications.

By default, Windows XP provides a new visual style. The scroll bars and title bar of a Windows Form will automatically use the new visual style when the form is run on Windows XP. If your application calls the EnableVisualStyles method, most of your Windows Forms controls will automatically use the visual style when your application is run on Windows XP.

Note Note

Windows XP visual styles support can also be enabled through the Enable Visual Styles check box in the Application pane of the Project Designer. For more information, see the topic How to: Enable Visual Styles (Visual Basic).

To enable visual styles

  • To enable visual styles in the client area of a Windows form, add the following code to your application's Main method.

    Application.EnableVisualStyles();
    
    NoteNote

    Some Windows Forms controls will look the same on all operating systems; implementing EnableVisualStyles does not affect these controls. These include the Label, LinkLabel, DomainUpDown, NumericUpDown, and CheckedListBox controls. Additionally, if you enable visual styles on some controls, the control might display incorrectly in certain situations. These include the MonthCalendar control with a selection range set, the TabControl with tab pages aligned at the bottom or sides of the control, and the handling of surrogate fonts in the TextBox control.

Show:
© 2014 Microsoft