Click here to Skip to main content
12,297,942 members (45,451 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# C#4.0
I have a toolstrip and i want to add a checkbox to it,but Idont know how to do it.
please help me.
Posted 28-Apr-10 19:32pm
Edited 5-Apr-16 18:39pm
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

in form load event:
CheckBox cb = new CheckBox();
cb.Text = "test";
cb.CheckStateChanged += (s, ex) => this.Text = cb.CheckState.ToString();
ToolStripControlHost host = new ToolStripControlHost(cb);
toolStrip1.Items.Insert(0,host);
[edit]Inline code changed to Code block: it preserves the formatting- OriginalGriff[/edit]
  Permalink  
v2
Comments
Pablo Aliskevicius 26-Aug-12 3:39am
   
My 5!
Also:

cb.BackColor = Color.Transparent; // to show the toolstrip background.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Don't use a CheckBox for this purpose.
On a ToolStrip you are supposed to use a ToolStripButton which has the same functionality as a CheckBox. Just use its Checked property!
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160525.2 | Last Updated 22 Apr 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100