Click here to Skip to main content
Click here to Skip to main content

OpenTheme : An open source graphic user interface (GUI) toolkit

, 22 Oct 2004
Rate this:
Please Sign up or sign in to vote.
An innovative alternative to XAML and XUL

Sample Image - maximum width is 600 pixels


OpenTheme is an XML based GUI toolkit with a set of foundation class and WYSIWYG editor. Although it's originally designed for full screen GUI, it is also good for Windowed user interface, with full localization support and arbitary look-and-feel.

I prepared a full tutorial at


When I was developing my OpenHTPC project, I was always thinking about how to make it looking cool. Since I'm not a graphic designer, I know I will never actually design any 'cool' graphics. That brought up an interesting old question, is there a way to completely separate the design of graphic user interface from the design of the business logic?

Well, since I'm confident I'm a fairly good software architect, I think I can do this job better. Finally, I designed this OpenTheme project. In this project, I tried some new technics. And finally I had chance to express my own opinion about software design and implementation in this project.

Using the code

It is still the preliminary Alpha release. So some of the design is still subject to changes. The best way to understand the design is to read the tutorial from a user's point of view.

But this release is already stable enough. The ThemeEditor can be used to design the entire ThemePack. In your code, just use the following code to load a Themepack.

// Create a ThemePack
ThemePack tp = ThemePack.FromXml(fileName, null);
// Run through Themes contained in the ThemePack

foreach (Theme curTheme in tp)
   // ........

// Get a Top Level page from Theme
ThemeObject themeObj = curTheme.GetThemeObject(ID);
// Draw this ThemeObject with a Graphics
themeObj.RecalculateLayout(Graphics g);
themeObj.Invalidate(Graphics g);

Points of Interest

A Theme is a collection of layered graphics (with alpha transparancy) with layout manager. System provides a set of 'atomic' components such as Images (OpenThemePictureBox), Text (OpenThemeTextBox), Color block (OpenThemeColorBox). Components can contain sub components within their bounds. The sub-components may contain other sub-components.

System also provides some more complicated components with custom code to determine the bounds of its sub-components for more complicated layout management. Those are called 'container' components.

Programmers can easily implement their own 'atomic' components and 'container' components. For example, the system provides a button component to support buttons with absolutly ARBITARY user designed look and feel. Below are the look and feels of that button with different state.






Another example is the horizontal scrollbar.

The logic is complete to define any popular components (such as button, radio, scrollbar, menu etc) with completely user defined look and feel, for full screen or windowed applications.

The system is very light-weighted. The core part only have barely more than 2000 lines of code and only dependent on some very basic GDI+ functions and XML library. And it doesn't even depend on Windows Forms classes. I would expect it to be ported to Linux platform and .Net compact framework with very little or no modification in the near future.


  • Oct. 20, Initial Alpha release.

TODO List:

  • Event model
  • Finish all common controls
  • Visual Studio .Net extensibility integration


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


About the Author

Web Developer
United States United States
Hello All!

Comments and Discussions

GeneralMy vote of 5 Pinmemberhi2hak3-Aug-11 10:34 
Generalgood Pinmemberfuturejo3-Aug-08 4:15 
Questionlicensing PinmemberJayTau11-May-07 20:26 
AnswerRe: licensing Pinmemberdedel20-Aug-07 0:10 
GeneralGreat job man... Pinmemberantecedents6-Feb-07 14:53 
GeneralNice but... PinmemberMarcel Härry16-Nov-06 13:51 
GeneralRe: Nice but... Pinmemberweiqj16-Nov-06 13:55 
GeneralRe: Nice but... PinmemberKenGuru16-Nov-06 21:41 
GeneralRe: Nice but... Pinmemberweiqj18-Nov-06 13:14 
QuestionRe: Nice but... Pinmemberstixoffire22-Mar-07 11:58 
AnswerRe: Nice but... Pinmemberweiqj23-Mar-07 6:55 
GeneralRe: Nice but... Pinmemberalcexhim29-Aug-13 7:45 
GeneralRe: Nice but... PingroupMarcel Härry14-Jul-14 9:52 
QuestionEvents Pinmemberobeea9-Aug-06 10:45 
AnswerRe: Events Pinmemberweiqj11-Aug-06 10:41 
Questionpublic repository? PinmemberN e m a23-Jan-06 9:29 
QuestionNo images, no icons PinmemberGord Murdoch15-Nov-05 19:28 
AnswerRe: No images, no icons Pinmemberweiqj16-Nov-05 14:49 
GeneralRe: No images, no icons PinmemberGord Murdoch18-Nov-05 8:52 
GeneralGetRelativeDirectory() error PinmemberSmangood18-Oct-05 19:08 
GeneralRe: GetRelativeDirectory() error PinsussAnonymous23-Oct-05 17:33 
GeneralAn error at runtime PinmemberCong Dan28-Sep-05 23:39 
GeneralRe: An error at runtime Pinmemberweiqj1-Oct-05 4:04 
Questionwhere can i download the ThemeEditor? PinmemberYour details have been updated11-Aug-05 21:20 
AnswerRe: where ican i download the ThemeEditor? Pinmemberweiqj14-Aug-05 5:02 
GeneralRe: where can i download the ThemeEditor? PinmemberYour details have been updated14-Aug-05 17:53 
GeneralRe: where can i download the ThemeEditor? Pinmemberweiqj15-Aug-05 10:53 
GeneralRe: where can i download the ThemeEditor? PinmemberYour details have been updated15-Aug-05 16:15 
Generalhelp running this program Pinmemberreb010123-Jul-05 19:12 
GeneralRe: help running this program Pinmemberweiqj26-Jul-05 10:14 
GeneralRe: help running this program Pinmemberreb010126-Jul-05 16:25 
GeneralRe: help running this program Pinmemberweiqj14-Aug-05 5:05 
QuestionWhat do I d Wrong? PinmemberNektov11-Jul-05 1:35 
AnswerRe: What do I d Wrong? Pinmemberweiqj11-Jul-05 18:17 
GeneralRe: What do I d Wrong? PinmemberNektov11-Jul-05 19:15 
GeneralRe: What do I d Wrong? Pinmemberweiqj13-Jul-05 8:43 
GeneralRe: What do I d Wrong? PinmemberNektov13-Jul-05 11:33 
GeneralRe: What do I d Wrong? Pinmemberweiqj13-Jul-05 14:05 
GeneralRe: What do I d Wrong? PinmemberNektov13-Jul-05 23:56 
QuestionCan I Use it in VB.NET PinmemberNektov8-Jul-05 6:28 
AnswerRe: Can I Use it in VB.NET Pinmemberweiqj9-Jul-05 14:27 
GeneralRe: Can I Use it in VB.NET PinsussAnonymous10-Jul-05 4:11 
GeneralRe: Can I Use it in VB.NET PinsussAnonymous10-Jul-05 4:56 
Questionhow to use it ? Pinsussgeoneo2-Mar-05 10:30 
AnswerRe: how to use it ? Pinmemberweiqj3-Mar-05 5:41 
Generalsweet Pinmembersuperman9529-Jan-05 20:19 
GeneralRe: sweet Pinmemberweiqj29-Jan-05 21:00 
GeneralRe: sweet Pinmembersuperman9530-Jan-05 19:20 
GeneralRe: sweet PinmemberPreky30-Jun-05 0:43 
GeneralPlugable graphics renderer PinsussMahdi Jeddi19-Dec-04 6:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150327.1 | Last Updated 22 Oct 2004
Article Copyright 2004 by weiqj
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid