Custom ComboBox

  • Thread starter Thread starter Mohammad-Reza
  • Start date Start date
M

Mohammad-Reza

Hi
I want to design a combo box.
I open a new UserControl project and inherits from
System.Windows.Forms.ComboBox
and try to override OnPaint event and set the DrawMode to OwnerDrawFixed.
But when I compile the project the interface did not change.
How can I override the OnPaint of this component.
Thanks in advance.
 
Mohammad,

When you set the DrawMode to OwnerDrawFixed, I believe that the event
will fire the DrawItem and the MeasureItem events, which you hook up to and
then provide painting code in there.

Hope this helps.
 
MeasureItem and DrawItem both are for drop down items and I want to change
the user interface of the control.


Nicholas Paldino said:
Mohammad,

When you set the DrawMode to OwnerDrawFixed, I believe that the event
will fire the DrawItem and the MeasureItem events, which you hook up to and
then provide painting code in there.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Mohammad-Reza said:
Hi
I want to design a combo box.
I open a new UserControl project and inherits from
System.Windows.Forms.ComboBox
and try to override OnPaint event and set the DrawMode to OwnerDrawFixed.
But when I compile the project the interface did not change.
How can I override the OnPaint of this component.
Thanks in advance.
 
Back
Top