[Mono-winforms-list] User defined graphics in a combo box

Stifu stifu at free.fr
Wed May 5 11:06:40 EDT 2010


Hi,

What I think I would do is create my own CustomComboBox that inherits from
ComboBox, and override the OnPaint method to use the Graphics DrawString and
Transform methods (to add and rotate a bit of text). This should let you do
what you want in a flexible way. Images could also be added this way, if you
prefer.

PS: note there are a couple of known Unicode bugs in Mono WinForms, so you
might want to double check that this U+2261 character displays properly in a
ComboBox. If needed, the Graphics DrawLine method could be used as a
workaround.


pfj wrote:
> 
> Hi,
> 
> I'm trying to put together a small organic chemistry application which
> will allow my students to create molecules which it will then name (or
> that the program generates for the student to name). What I'm trying to do
> is this
> 
> Type in the name of the atom (say C). To either side, above and below a
> combo appears which has in it a single (-), double (=) or triple bond
> (there is a character for that - according to OOo, its U+2261). While this
> is okay, if I want to do the same for the above and below, this will be
> hard as there is not an equals sign twisted to 90 degrees or U+2261 turned
> through 90 degrees.
> 
> Back when I was a lad and used the ol' 8 bit systems, I could create a
> user defined graphic which would show the || and ||| as a single
> character. Today, I'm guessing a png or bmp file would do the same,
> however, I can't see anything that says I can put a graphic in a
> drop-down. 
> 
> Can it be done?
> 
> TTFN
> 
> Paul
> 

-- 
View this message in context: http://mono.1490590.n4.nabble.com/User-defined-graphics-in-a-combo-box-tp2130724p2131082.html
Sent from the Mono - WinForms mailing list archive at Nabble.com.


More information about the Mono-winforms-list mailing list