方式一:枚举每个ToolStripItem,当枚举的量与按下键相同则选中
For Each item As ToolStripItem In Me.Toolbar2.Items
If (TypeOf item Is ToolStripButton) Then
If DirectCast(item, ToolStripButton).Text <> Button.ClickedItem.Text Then
DirectCast(item, ToolStripButton).Checked = False
Else
DirectCast(item, ToolStripButton).Checked = True
End If
End If
Next
方法二:
For Each intBBB As System.Windows.Forms.ToolStripButton In Toolbar2.Items.OfType(Of System.Windows.Forms.ToolStripButton)()
If intBBB.Text = Button.ClickedItem.Text Then
intBBB.Checked = True
Else
intBBB.Checked = False
End If
Next