DropDownMenuItem check should uncheck other DropDownMenuItems

一曲冷凌霜 提交于 2019-12-04 19:58:01

You need to code it manually. When clicking on a sub menu, uncheck all other siblings:

For index = 1 To 5
    Dim subMenu = New ToolStripMenuItem(index.ToString())
    subMenu.CheckOnClick= True
    AddHandler subMenu.Click, Sub(obj, arg)
        Dim item = DirectCast(obj, ToolStripMenuItem)
        For Each sibling In item.Owner.Items.OfType(Of ToolStripMenuItem).Except({obj})
           sibling.Checked = False
        Next sibling
    End Sub
    Menu1ToolStripMenuItem.DropDownItems.Add(subMenu)
Next
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!