By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,722 Members | 1,264 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,722 IT Pros & Developers. It's quick & easy.

Ownerdrawn combobox (hopefully not to be plundered this time)

P: n/a
I have an ownerdrawn combo box which I am drawing with an image and some text, this is all working beautifully apart from the difference in the Brush I have to draw the background and the text with if the item is the currently selected one.

I have selected a blue (SystemColors.Highlight) background brush and white (SystemColors.HighlightText) text brush if the item is the highlighted one, but when I do that instead of functioning like a normal combobox (when dropped down) where the items get selected as you mouse over them, as you mouse over each one, the previously selected (i.e. drawn blue) one *stays selected* until you scroll.

Obviously I don't want this behaviour. I've checked I haven't got some multiselect property on or anything. I've written a function which I call to draw the item unselected which in the OnDrawItem I always call to unselect the previous item which is a bit of a kludge, but is there a more normal way? I tried faffing around with the Invalidate method but to no avail.

Oh and another thing is there anyway to get the combo box in its default mode (i.e. with the text box enabled) to show the picture in the text box, as it does on drop down list mode (but I want the text box to stay enabled)... probably not, but just in case! I've got the combo box set to drop down (the standard, i.e. not 'drop down list' or 'simple')

Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Beeves,

Can you paste your ComboBox class code with paint events? It will help me to
investigate further.

--
Shak
(Houston)
"Beeeeeeeeeeeeves" <Be**************@discussions.microsoft.com> wrote in
message news:FE**********************************@microsof t.com...
I have an ownerdrawn combo box which I am drawing with an image and some text, this is all working beautifully apart from the difference in the Brush
I have to draw the background and the text with if the item is the currently
selected one.
I have selected a blue (SystemColors.Highlight) background brush and white (SystemColors.HighlightText) text brush if the item is the highlighted one,
but when I do that instead of functioning like a normal combobox (when
dropped down) where the items get selected as you mouse over them, as you
mouse over each one, the previously selected (i.e. drawn blue) one *stays
selected* until you scroll.
Obviously I don't want this behaviour. I've checked I haven't got some multiselect property on or anything. I've written a function which I call to
draw the item unselected which in the OnDrawItem I always call to unselect
the previous item which is a bit of a kludge, but is there a more normal
way? I tried faffing around with the Invalidate method but to no avail.
Oh and another thing is there anyway to get the combo box in its default mode (i.e. with the text box enabled) to show the picture in the text box,
as it does on drop down list mode (but I want the text box to stay
enabled)... probably not, but just in case! I've got the combo box set to
drop down (the standard, i.e. not 'drop down list' or 'simple')

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.