Blog

How to create an icon combobox with edaitable textbox for windows forms

Posted by Toshinobu Yamaguchi Blogs | Windows Forms C# Dec 06, 2010
Windows Forms / custom controls tips
Creating DropDownList style icon combobox(not editable) is not difficult.
You just set DrawMode to OwnerDrawFixed or OwnerDrawVariable,
then hook up the MeasureItem and DrawItem events.

On the other hand, creating icon combobox with editable text box is really difficult.
Because .net framework don't allow changing margin of editable portion
of combobox, and overriding OnPaint method of combobox.

I found good sample code to create an icon combobox with editable textbox.
He use Win32API to solve the problems. It's tough work!
The sample code and DLL are for .NET 1.1.
However, I think this technique could be applied for .net 3.0/3.5.
Does anyone know the code written by .net 3.0/3.5?

If you are using my combobox, creating editable combobox is easy.
You just set DrawMode and TextLeftMargin propeties, hook up DrawItem event and override OnPaint method.


iconcombo.jpg
--
COMMENT USING
PREMIUM SPONSORS
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.
SPONSORED BY
  • MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.