Click here to Skip to main content
13,249,813 members (85,263 online)
Click here to Skip to main content
Add your own
alternative version


106 bookmarked
Posted 7 Dec 2005

SkinControls: Button, CheckBox and RadioButton controls with built-in styles

, 15 Mar 2006
Rate this:
Please Sign up or sign in to vote.
Custom drawn button, checkbox and radiobutton controls.


I have finished my project dotnetskin which skins forms and controls automatically for .NET WinForms applications. I am demonstrating some code and images from that project in this article. The SkinControls library includes four components, providing skinned buttons, check boxes and radio buttons with three built-in styles. It is an excellent example of creating custom drawn controls.

Using the code

In order to use the library in your project, add it to your VS toolbox:

  • Right-click on the "General" tab in the Toolbox.
  • Choose "Add/Remove Items..."
  • On the ".NET Framework Components" tab, press the "Browse..." button and find DotNetSkin.SkinControl.dll.

That will add four component icons to the General tab. Drag the "SkinImage" icon to your form.


The SkinImage component provides skin images for all controls. It loads a skin image from a resource. All images are stored in a static object, so you need to add only one SkinImage component to your project.

The skin image can be in any image format that the .NET framework supports. I used PNG files including an alpha channel that determines the transparency.

This is the button image in Mac style.

The SkinImage has a Scheme property to set the skin scheme. There are three schemes available in the library's resources: Macos style, XP style, Plex Style.

This is the SkinImage code:

public class SkinImage:Component
    public static ImageObject button;
    public static ImageObject checkbox;
    public static ImageObject radiobutton;

    private Schemes scheme = Schemes.MacOs;

    public SkinImage()

    static SkinImage()

    protected static void Macskin()
        button = new 
        checkbox = new 
          12,new Rectangle(0,0,0,0));
        radiobutton = new 
          8,new Rectangle(0,0,0,0));

    protected static void Xp1skin()
        button = new 
        checkbox = new 
          12,new Rectangle(0,0,0,0));
        radiobutton = new 
          8,new Rectangle(0,0,0,0));

    protected static void Plexskin()
        button = new 
        checkbox = new 
          12,new Rectangle(0,0,0,0));
        radiobutton = new 
          8,new Rectangle(0,0,0,0));

    protected override void Dispose( bool disposing )
        if (disposing)
        base.Dispose( disposing );

    public Schemes Scheme
        get { return scheme;}
            scheme = value;
            {    switch (scheme)
                    case Schemes.MacOs:
                    case Schemes.Xp:
                    case Schemes.Plex:
            catch (Exception)


The button skin image has five button images tiled. These images are used in the Normal, MouseOver, MouseDown, Disabled, and the Focused states of buttons. In order to support non-rectangle images, the SkinButton supports a transparent background. The key is to call base.InvokePaintBackground to draw the parent background.

Non-transparent backgroundTransparent background
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)

    Rectangle rc = this.ClientRectangle;
    Graphics g = e.Graphics;

    //Draw parent background
         new PaintEventArgs(e.Graphics, base.ClientRectangle));

    //Draw skin image

    //.... Draw button text

SkinCheckbox and SkinRadioButton

The checkbox control has twelve images tiled and the radio button has eight images. These images are used in the Normal, MouseOver, MouseDown, the Disabled states.


  • 2/10/2005 - First released.
  • 3/15/2006 - Fixed bug when button is pressed down, supports shoutcut '&' in button.text.


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

Pan wen
Web Developer
China China
I am working on developing a skin user interface library to enhance .Net Win forms application. Download it project from feel free to email me for problem and bugs on my components.

You may also be interested in...


Comments and Discussions

GeneralMy vote of 1 Pin
DoubleGhost11-Apr-11 22:24
memberDoubleGhost11-Apr-11 22:24 
GeneralMy vote of 1 Pin
zhang7cy18-Sep-09 15:16
memberzhang7cy18-Sep-09 15:16 
Questionvery bad!!! Pin
M.Khadem8-Jul-07 2:45
memberM.Khadem8-Jul-07 2:45 
QuestionFree Use Pin
cecypaz13-Apr-07 10:57
membercecypaz13-Apr-07 10:57 
Generalchange form caption (officce 2007) [modified] Pin
hamid_m10-Mar-07 4:12
memberhamid_m10-Mar-07 4:12 
GeneralText Align Centre doesn't work for multiline buttons Pin
Chris Nevill11-Jan-07 3:11
memberChris Nevill11-Jan-07 3:11 
GeneralCache images Pin
hflorin13-Dec-06 6:13
memberhflorin13-Dec-06 6:13 
GeneralStill not supporting the & in the button.text Pin
saifonly10-Aug-06 0:30
membersaifonly10-Aug-06 0:30 
QuestionCheckedListBox Pin
dario773-Jul-06 12:15
memberdario773-Jul-06 12:15 
QuestionFound a bug in the control Pin
anu_kgec21-Feb-06 23:11
memberanu_kgec21-Feb-06 23:11 
AnswerRe: Found a bug in the control Pin
Pan wen22-Feb-06 12:43
memberPan wen22-Feb-06 12:43 
GeneralRe: Found a bug in the control Pin
anu_kgec22-Feb-06 23:47
memberanu_kgec22-Feb-06 23:47 
GeneralRe: Found a bug in the control Pin
Pan wen23-Feb-06 12:49
memberPan wen23-Feb-06 12:49 
GeneralRe: Found a bug in the control Pin
2ASoft28-Feb-06 17:05
member2ASoft28-Feb-06 17:05 
GeneralMy apologies to the author! Pin
Marc Clifton8-Dec-05 4:59
protectorMarc Clifton8-Dec-05 4:59 
Generalsmall issue Pin
MCHANNER8-Dec-05 1:00
memberMCHANNER8-Dec-05 1:00 

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

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

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171114.1 | Last Updated 15 Mar 2006
Article Copyright 2005 by Pan wen
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid