Click here to Skip to main content
13,558,844 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
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
Updated 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  
Comments
DKcorps 8-May-18 7:56am
   
How do I make the ToolStripButton have the same look and feel as a checkbox?

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 |
Web02-2016 | 2.8.180515.1 | Last Updated 22 Apr 2016
Copyright © CodeProject, 1999-2018
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