0

I'm trying to use the ColorSelector class from this example:
Placing Images and Strings with a C# Combobox
I need to step further and use own, external images, thus set the height of the ColorSelector control accoring to the known height of the image to be drawn. So I want to set the "internal" height of the combobox to the maximum of the image height and the natural size of the text. I played a lot with overriding GetPreferredSize, DefaultSize, PreferredSize, MinimumSize, MaximumSize and some combinations of these. (No valuable result so it is meaningless to provide some code.)
How to achieve this?
Thanks.

Community
  • 1
  • 1
Feri
  • 461
  • 4
  • 12
  • https://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.measureitem(v=vs.110).aspx – Hans Passant Sep 19 '16 at 22:24
  • Hans Passant: Thank you! Somehow I thought that the solution of this problem layed far upper in the inheritance hierarchy, near to Control... Another minor problem: the MeasureItemEventArgs class has no information about the font/text to be using, although the measuring/sizing would need to know the text size as well... Any idea? – Feri Sep 20 '16 at 11:37
  • Well, sure you do, you get e.Index. Just use this.Items[e.Index].ToString() to get the text. – Hans Passant Sep 20 '16 at 12:35

0 Answers0