Extend System.Windows.Forms.ComboBox
I would like to extend the System.Windows.Forms.ComboBox control with the ReadOnly property, which displays the text of the selected items (similar to a label) when ReadOnly = true. (I don't like that the disabled view is achieved by setting Enabled = false)
How do I do this in winforms? This was very easy in ASP.NET where all I had to do was override the Render method. However, this is not so easy with winforms.
From what I'm about, I need
a) Override OnPaint method
b) Call this.SetStyle (ControlStyles.UserPaint, true) to call OnPaint.
But now it seems to me that I have to do the whole picture myself. It's true? Couldn't the underlying ComboBox be allowed to handle coloring the control when ReadOnly = false? Also, what ControlStyles should I be using?
source to share