No announcement yet.

Windows themed buttons and textboxes

  • Filter
  • Time
  • Show
Clear All
new posts

  • Windows themed buttons and textboxes

    How do I cause my buttons and other controls to inherit the Windows Theme. I've got Firefly and I want to be able to create those types of controls but don't have a full understanding yet of just how they are created. All I know is to use CreateWindowEx with a registered class or create and register a class of my own. Is there a simple example of an SDK Window, and a small variety of controls. I'd like to get more control over the look and feel without having to rely on Firefly, although it's a super product for a new project, I have existing code that I don't want to have to completely rewrite.


    Is it my best option to just study the generated code from Firefly or Phoenix Thunder?


    Bob Mechler

  • #2
    AFAIK, if you use owner-drawn buttons and use only the system colors (GetSysColor, GetSysColorBrush) themes are automatcally inherited. Or maybe it's "Don't owner-draw at all."

    I'm pretty sure it's something like that, because when I did some owner-draw buttons and used my own colors only for some things - allowing the system to handle the rest - my buttons looked simply awful when run on a "themed" system.

    But that was a long time ago, so there might be some better way to handle it now.

    Easy enough to test: Write a 'nothing' screen with some "not owner drawn" buttons and text boxes etc, turn themes on and off on your system and see what happens.
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]


    • #3
      There are two ways to make an existing application theme aware:
      • Create a manifest file named <MyApp>.exe.manifest, where Myapp is the name of your application, in the same directory where your application resides.
      • Create a manifest file and add it to the resource file used by your application.

      More information:


      • #4
        The <MyApp>.exe.manifest worked right out of the box. With 300 hundred plus programs, I'll need to go on and add this to my resource file.
        Great information. Your site is an incredible resource.

        Many thanks,

        Bob Mechler


        • #5
          I use FireFly too and have some of my apps with themes. A Resource is the best way to go. FireFly has an option in Code Generation too. I never use it, but I think it adds a resource too, and it makes FireFly display the Form how it will look with themes in the IDE. FireFly itself uses a manifest file since it is easy to delete and disable themes so the IDE doesn't show them.

          Keep in mind that you get some "extras" with themes too. Automatic Balloon tips on Password and Numeric Text boxes telling you if Caps is on or if non-numeric (This sometimes causes issues with Frame Controls painting and you have to play with the clip/drawing styles, Frame Controls actually color different too). You also get better Balloon Tooltips, if you use them, with more options. If your Checkbox/Radio Buttons have text that is colored it won't be colored. Statusbars paint different and panel size is off. Buttons are themed, but image buttons are not (Unless done manually, and I think Jose has some buttons on his page doing this too). And Tab Control colors are different. That and Tabs with images don't theme in transparent regions of image either...Probably could be done manually as with buttons, but right now FF doesn't do it.
          Mobile Solutions
          Sys Analyst and Development