Click here to Skip to main content
13,248,343 members (58,457 online)
Click here to Skip to main content
Add your own
alternative version


23 bookmarked
Posted 27 Mar 2007

Appearance Customizable ComboBox

, 27 Mar 2007
Rate this:
Please Sign up or sign in to vote.
A class implementing .Net ComboBox Control that allows appearance customization.
Screenshot - demo.gif


This class is derived from the .NET ComboBox class. It provides coloring and stylish customization to change the appearance of ComboBox's border and drop down button. An independent set of properties can be customized for both the GotFocus and LostFocus statuses. These properties are customizable from within the designer.

The original ComboBox control provided by .NET 2.0 Framework is very limited in the ability to customize the appearance. A lot of people have created their own custom made ComboBox instead of deriving from the ComboBox from .NET Framework. It might be due to the OnPaint function of the .NET ComboBox being inaccessible to the text box area of the ComboBox. You can allow overriding of the OnPaint function by using this statement in the constructor:

public CustomComboBox() : base()
    SetStyle(ControlStyles.UserPaint, true);

An alternative to re-drawing the ComboBox control is by overriding the WndProc function. However this approach can be significantly complicated to many beginners of C#, .NET or Win32 programming, especially when they want to continually select the suitable color and style to match the design of their application.


This project is extended from the existing project, "Making Standard ComboBox appear flat" contributed by Fadrian Sudaman. I am impressed with what has been done by Fadrian Sudaman to draw on top of .NET ComboBox control by using WndProc.

Using the code

This class inherits from .NET ComboBox.

Instead of using:

ComboBox cboDemo = new ComboBox();

You can use:

ComboBox cboDemo = new CustomComboBox();
// or
CustomComboBox cboDemo = new CustomComboBox();

To use this class, reader needs to understand the standard functions, properties and events of .NET ComboBox, and a few new properties created in this inherited class.

Sample Image - maximum width is 600 pixels

Points of Interest

I have spent a lot of time to fix the flickering problem of this inherited control. I cut off a lot of unnecessary codes and simplified out the overridden WndProc function. I also changed the several "OnEvent" function and moved the Invalidate() to before base.OnEvent(e).

It still does flicker, especially if I set my video acceleration to None. However, I believe this should have minimized flickering into an acceptable level.


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

Singapore Singapore
Ng Pei Jiun, Eugenis, graduated from National University of Singapore. After worked for one year as VB .NET and C# .NET programmer, I had decided to do freelancing in order to experience more about SDLC and Project Management.

I am currently unemployed and having intermediate skill in C# .NET programming.

You may also be interested in...

Comments and Discussions

QuestionChanging the Control Style to User Paint Pin
iSwoop28-Sep-12 2:20
memberiSwoop28-Sep-12 2:20 
Questionfixed Pin
Member 41579894-May-12 12:53
memberMember 41579894-May-12 12:53 
AnswerRe: fixed Pin
komyoschong12-Aug-12 11:42
memberkomyoschong12-Aug-12 11:42 
GeneralRe: fixed Pin
omegarizla2-Nov-12 1:41
memberomegarizla2-Nov-12 1:41 
QuestionError on Resize Pin
Member 41579894-May-12 12:17
memberMember 41579894-May-12 12:17 
QuestionHow to make combobox to drop up instead of drop down? Pin
Shrini5-Sep-07 0:08
memberShrini5-Sep-07 0:08 
AnswerRe: How to make combobox to drop up instead of drop down? Pin
Wang Chun Hsun3-Nov-16 21:37
memberWang Chun Hsun3-Nov-16 21:37 
Questioncan you build this in in 2003? Pin
honpher25-May-07 6:23
memberhonpher25-May-07 6:23 

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
Web01 | 2.8.171114.1 | Last Updated 28 Mar 2007
Article Copyright 2007 by Eugenis
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid