G
Garry
I have written vb.net code to add toolstripbuttons to a predefined toolstrip
on my MDI child form.
I can assign them a .bmp file from a global ImageList etc. I used the
'behind code' to get a code sample to do this BUT, I cannot see a way to add
a single event handler to deal with the various buttons on this toolstrip. I
mean using a select statement.
Anyone have any ideas?????
Garry
Example of running code
Dim Button As ToolStripButton = New ToolStripButton
toolstrip.ImageList = gimglst
toolstrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Button})
Button.Image = gimglst.Images("SaveAndClose")
Button.Name = "SaveAndClose"
Button.ToolTipText = "Save and Close"
ConferPropertiesToButtons(Button)
Button = New ToolStripButton
toolstrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Button})
Button.Image = gimglst.Images("CloseNoSave")
Button.Name = "CloseNoSave"
ConferPropertiesToButtons(Button)
Private Sub ConferPropertiesToButtons(ByVal button As ToolStripButton)
button.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image
button.ImageTransparentColor = System.Drawing.Color.White
button.Size = New System.Drawing.Size(23, 22)
button.Text = ""
End Sub
on my MDI child form.
I can assign them a .bmp file from a global ImageList etc. I used the
'behind code' to get a code sample to do this BUT, I cannot see a way to add
a single event handler to deal with the various buttons on this toolstrip. I
mean using a select statement.
Anyone have any ideas?????
Garry
Example of running code
Dim Button As ToolStripButton = New ToolStripButton
toolstrip.ImageList = gimglst
toolstrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Button})
Button.Image = gimglst.Images("SaveAndClose")
Button.Name = "SaveAndClose"
Button.ToolTipText = "Save and Close"
ConferPropertiesToButtons(Button)
Button = New ToolStripButton
toolstrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Button})
Button.Image = gimglst.Images("CloseNoSave")
Button.Name = "CloseNoSave"
ConferPropertiesToButtons(Button)
Private Sub ConferPropertiesToButtons(ByVal button As ToolStripButton)
button.DisplayStyle =
System.Windows.Forms.ToolStripItemDisplayStyle.Image
button.ImageTransparentColor = System.Drawing.Color.White
button.Size = New System.Drawing.Size(23, 22)
button.Text = ""
End Sub