VisualStyles in Whidbey


Support for VisualStyles in Windows Forms has considerably improved in Whidbey.
Here is a list of some of the new features. These should all be in the PDC build.

  • Application.EnableVisualStyles is
    now part of the “Windows Forms Application” template in Visual Studio. This means
    VisualStyles will be enabled by default in new Windows Forms apps (VB will be using
    a slightly different approach, but essentially, the behavior will be the same).
  • The issues you
    came across with using Application.EnableVisualStyles in .NET Framework v1.1 are fixed,
    for the most part. You shouldn’t need to use any workaround to get imagelists working,
    for example. If you are using the PDC build and still noticing problems, please do
    let us know!
  • Controls like Button, RadioButton, ComboBox and GroupBox all render themed by default
    when VisualStyles are enabled. This means you won’t need to set their FlatStyle to
    System to get the themed look and feel. This is great, because setting FlatStyle to
    System also meant you lost some of the benefits of Windows Forms doing the rendering
    – like the ability to set a BackColor, BackgroundImage etc.
  • Some of the other controls that didn’t get the visual styles look and feel in v1.1
    (like the UpDown controls) now have that support.
  • We have added a bunch of new control renderer classes in Whidbey that give you the
    ability to render controls with the visual styles look and feel, like ButtonRenderer,
    CheckBoxRenderer, ComboBoxRenderer, ProgressBarRenderer etc.
  • We have added a class called VisualStyleRenderer that serves as an easy-to-use, managed
    wrapper for the UxTheme
    API
    that shipped with Windows XP.

Comments (17)

  1. I’m glad to see that the UpDown controls will now get visual style support. Will the TabPage control also get visual style support? Currently, when a TabPage is added to a TabControl, there is the normal control background color instead of the themed background. Pierre Arnaud attempted to fix the problem and posted his solution on The Code Project.

    http://www.codeproject.com/cs/miscctrl/themedtabpage.asp

    It would be really nice if this problem was fixed for the Whidbey release.

  2. Justin: Yes, the TabPage control will get the visual style rendering too (the fix isn’t in the PDC build, though).

  3. Neal Andrews says:

    Is the ImageList going to be fixed in Whidbey? I have noticed that it does not support 32bpp images very well. ie you cannot draw a scaled Image from an ImageList without lossing the Alpha information from the image (It is drawn black. I have also noticed problems with adding additional 32bpp images (with valid alpha) to the imagelist from the IDE , where all the images in the ImageList loose there alpha information. Still aleast Whidbey allows to to add more than one image at a time the an ImageList;)

  4. Neal: I followed up with some folks on my team about your concerns with the ImageList. Apparently, they are aware of the issues and are thinking about how to address them. I don’t know the details, but if you are interested, you could get in touch with Mike Harsh – his blog is at http://weblogs.asp.net/mharsh.

  5. Theme newbie says:

    I’m new to this XP theme stuff, I have beta 1 and I don’t see XP Themes being applied. I am obviously missing something, can someone point me to some code?

  6. Theme newbie says:

    Never mind our Windows policy had diabled XP Themes. It works! Good work guys.

  7. Etienne Boucher says:

    Sadly, the RichTextBox is still missing his themed border.

  8. Etienne – yes, this is something which is being looked at in the post-Beta 1 timeframe.