Populate ComboBox with line styles .NET
How could I populate a ComboBox (or a ToolStripComboBox like in the image) with line sty开发者_运维百科les .NET?
alt text http://lh4.ggpht.com/_1TPOP7DzY1E/S9ASrI4TE8I/AAAAAAAADKo/pNzm6MVyYkA/s800/linestyles.png
You need to draw the items yourself. The ComboBox has a DrawItem
event for that. You can get both the boundaries of the item and the graphics context from the event arguments.
You'll need to set the DrawMode property on the ComboBox to OwnerDrawFixed for that to work, though.
I'm assuming that finding the DashStyle enumeration and creating an item for each enum value is not your problem here.
精彩评论