以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 一个WinForm.Strip对象,如何获取其类型(StripTypeEnum)? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=152214) |
-- 作者:Hopenight -- 发布时间:2020/7/9 17:08:00 -- 一个WinForm.Strip对象,如何获取其类型(StripTypeEnum)? 如题 类似地,一个WinForm.StripItem对象,如何获取其类型(StripItemTypeEnum)?
[此贴子已经被作者于2020/7/9 17:11:50编辑过]
|
-- 作者:有点蓝 -- 发布时间:2020/7/9 17:31:00 -- 获取WinForm.StripItem对象的.net类型,然后参考下面代码反向判断一下 Select Case Type Case StripItemTypeEnum.MenuItem item = New ToolStripMenuItem Exit Select Case StripItemTypeEnum.Button item = New ToolStripButton With { _ .DisplayStyle = ToolStripItemDisplayStyle.Image _ } Exit Select Case StripItemTypeEnum.Label item = New ToolStripLabel Exit Select Case StripItemTypeEnum.SplitButton item = New ToolStripSplitButton With { _ .DisplayStyle = ToolStripItemDisplayStyle.Image _ } Exit Select Case StripItemTypeEnum.TextBox item = New ToolStripTextBox Exit Select Case StripItemTypeEnum.ComboBox item = New ToolStripComboBox Exit Select Case StripItemTypeEnum.Separator item = New ToolStripSeparator Exit Select End Select
|