开发者

Populate ComboBox with line styles .NET

开发者 https://www.devze.com 2022-12-27 14:29 出处:网络
How could I populate a ComboBox (or a ToolStripComboBox like in the image) with line sty开发者_运维百科les .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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号