I am looking to add a single toggle button to a windows form that is not part of a toolbar. Is there a stand alone togglebutton control that can be used (ie not a toolbar button)
Using VS05: The checkbox with the appearance set to 'button' will toggle for you...and you can place this anywhere on you form and use the 'checkedchanged' event to execute your code against user clicks
On the toolstrip you can add a normal button - set it DisplayType to image and then set its checked property
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click Me.ToolStripButton1.Checked = Not Me.ToolStripButton1.Checked If Me.ToolStripButton1.Checked Then Me.ToolStripButton1.Image = My.Resources.CLIP01 Else Me.ToolStripButton1.Image = My.Resources._35FLOPPY End If End Sub This would give a togglable button in a toolstrip. I've also used the nice My.Resources to check the button image depending upon state which further highlights the toggle state.
togglebutton
Manip
Paola B.
Wessam Bahnassi
The checkbox with the appearance set to 'button' will toggle for you...and you can place this anywhere on you form and use the 'checkedchanged' event to execute your code against user clicks
unborracho
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
Me.ToolStripButton1.Checked = Not Me.ToolStripButton1.Checked If Me.ToolStripButton1.Checked Then
Me.ToolStripButton1.Image = My.Resources.CLIP01
Else
Me.ToolStripButton1.Image = My.Resources._35FLOPPY
End If
End Sub
This would give a togglable button in a toolstrip. I've also used the nice My.Resources to check the button image depending upon state which further highlights the toggle state.