Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Buttons and Floating containers supporting user defined themes

0.00/5 (No votes)
1 Dec 2003 1  
Provides an XP look and feel over which you have ultimate control

Sample screenshot

Introduction

It seems every developer that hits DotNet wants to produce some buttons. However, these buttons are not part of a big picture. What I am trying to do here is produce a theme system, that control developers use to draw their controls. When a user sees a control which has adopted the theme system it looks to them like it "belongs", i.e. it's basically drawn in the same style and color scheme as all other elements in their user interface.

I am seeking others to collaborate with, intially in VB.NET with others doing conversions to other .NET languages. The aim being to develop a full and useful range of controls which have adopted the theme system.

Details

A detailed study of the CtlButton and CtlFloatbar source code may be required to understand how a theme is adopted, but a quick look at the enclosed demo, which will need minimal edits before it will run, will immediately demonstrate the objective.

The code uses minimal API techniques and is written in VB.NET using .NET 1.0. It calls upon the Graphics class by using the VisualTheme class to provide critical information which affects the way in which a control is drawn. For example, when opening a form, the theme can dictate the forms background color. The theme also governs the 3D look of buttons and even supports caption buttons as you see in Windows own caption bars. The theme affects the borders of button controls in this example, so that the user can see which the Default (Accept) buttons is, which is the Cancel/Abort buttons, which button has focus and which control is being pointed to by the mouse.

The system also demonstrates a primitive system for drawing drop shadows beneath controls. The VisualTheme class is also called upon to perform this task, it's slow, but all this stuff is to demonstrate a concept which hopefully others will assist me in completing.

Conclusion

Comments to dev@bobbieandchris.com are all welcomed together with offers of collaboration. Ownerships is not an issue here, but quality is, so lets work for the greater good.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here