Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Draw icon next to edit control in combo box

Status
Not open for further replies.

Skute

Programmer
Jul 21, 2003
272
GB
Hi, how can i draw an icon next to the edit control in a combo box? Ive successfully managed to draw a list icons in the listbox, but now i want to draw the icon that the user selected next to the text in the edit box.

Ive obtained the edit box by attaching to it in the OnCtlColor() message of the combo box. But when i try to SetWindowPos on it to make it 19 pixels smaller, it doesnt work! Any tips on this would be greatfully received.

Thanks


Skute

"There are 10 types of people in this World, those that understand binary, and those that don't!"
 
How about setting up the combo box to be owner-drawn? You would have to implement the WM_DRAWITEM message in the combo box's owner window. Then you get to display whatever you want within the bounds of the combo box, including icons and such. The down side is that you have to do all the drawing, even the parts in the default combo box that you don't need to change, and the drawing can be complicated (you need to get the right font set for the edit box, draw all the 3D box effects, etc.)
 
My combo box is setup as owner drawn - thats how ive got the images for desktop, my computer etc showing. but owner drawn doesnt allow you to paint the default edit box.

Skute

"There are 10 types of people in this World, those that understand binary, and those that don't!"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top