2013年6月3日 星期一

ToolStripDropDownItem 用法

MSDN:ToolStripDropDownItem.DropDownItems Property
參考引用:Creating a Event handle for a DropDownItem in a MenuStrip
 --
Private Sub managerToolBar()
        Dim food As ToolStripMenuItem = New ToolStripMenuItem
        Dim addToolStripItem As ToolStripMenuItem = New ToolStripMenuItem("&add")
        AddHandler addToolStripItem.Click, AddressOf Me.addToolStripItem_Click
        food.DropDownItems.Add(addToolStripItem)
        Me.menuStrip1.Items.Add(food)
    End Sub
   
    Private Sub addToolStripItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        MessageBox.Show("add")
    End Sub 

沒有留言:

張貼留言