[Mono-winforms-list] User defined graphics in a combo box
Jonathan Pobst
monkey at jpobst.com
Wed May 5 11:18:34 EDT 2010
If you want to custom paint the ComboBox chrome (not the item it shows),
this is the way to go.
If you want to custom paint the ComboBox items (including the one
currently shown in a closed ComboBox), Robert's example using OwnerDraw
is the way to go.
Jonathan
On 5/5/2010 10:06 AM, Stifu wrote:
>
> 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
>>
>
More information about the Mono-winforms-list
mailing list