Tech Off Thread

10 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

All .net controls in Win XP style

Back to Forum: Tech Off
  • User profile image
    ZippyV

    How do I show all the controls on my form in Win XP style? I tried to use Application.EnableVisualStyles but that doesn't change every control (like numericupdown, tabs with shading background).

    I know there are some libraries that can do this for me, but I'd like to do it all myself. Do I have to use interop? Like this one:
    http://www.pinvoke.net/default.aspx/uxtheme.EnableTheming

  • User profile image
    Blue Ink

    ZippyV wrote:

    How do I show all the controls on my form in Win XP style? I tried to use Application.EnableVisualStyles but that doesn't change every control (like numericupdown, tabs with shading background).

    I know there are some libraries that can do this for me, but I'd like to do it all myself. Do I have to use interop? Like this one:
    http://www.pinvoke.net/default.aspx/uxtheme.EnableTheming



    As all this works fine in VS2005 I'll assume you are using VS2003... and if that's the case, the advice is <drums /> "move to VS2005". Smiley

    The advice sounds silly, but having been there myself, I found that theme support is a bit flaky in VS2003 and anything you will do to fix it will make your applications less portable when you (eventually) move to 2005. Just to give you an idea, even if you go and subclass the tab page control to fix the background issue, you will then have to subclass radio buttons and check buttons as well, as they do not paint a proper background... and maybe some other control needs fixing as well.
    If you really must keep using VS2003, then I would recommend that you use some libraries (I think there are some nice examples on codeproject.com) as doing it right is a lot of silly work.

    HTH
    --m

  • User profile image
    ZippyV

    I guess I could use the Skybound component:
    http://www.skybound.ca/developer/visualstyles/default.aspx

    but then I still don't know how they did it. I'll try codeproject later.

  • User profile image
    TommyCarlier

    If you want to know how they did it, you could use Reflector.

  • User profile image
    Blue Ink

    ZippyV wrote:
    I guess I could use the Skybound component:
    http://www.skybound.ca/developer/visualstyles/default.aspx

    but then I still don't know how they did it. I'll try codeproject later.


    I found the URL with the example I was mentioning:
    http://www.codeproject.com/cs/miscctrl/themedtabpage.asp

    Good luck
    --m

  • User profile image
    Sven Groot

    Application.EnableVisualStyles is... problematic. Use a manifest file for comctl32.dll v6, as described here.

    It won't solve the tab problem, but it'll get rid of some of the issues with EnableVisualStyles.

    The tabs isn't easy. You could inherit from the TabPage control, override OnPaintBackground and make the proper PInvoke calls to the theming API to draw the background, that's the only way there is.

  • User profile image
    Dial

    You also need to make sure that each controls FlatStyle property is set to System.

  • User profile image
    Tensor

    You could spend a lot of time making all the windows default controls style up properly...

    Or you could buy 3rd party controls. They are not cheap at first glance but compare it to the amount of time you will spend fricking about with tab pages and the like and you will probably see it makes sense. Plus you will get a decent grid.

  • User profile image
    Tensor

    Ah - for a school project, then yeah, 3rd party controls is probably overkill Perplexed

  • User profile image
    ZippyV

    I need it for a programming project for school so I don't think they will allow 3th party controls.
    My biggest issue right now is how do I get the numeric updown control in XP style?

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.