Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: 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
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 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 at 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 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
0 Sergey Alexandrovich Kryukov 718
1 OriginalGriff 421
2 Tadit Dash 355
3 sanket saxena 329
4 Peter Leow 193
0 Sergey Alexandrovich Kryukov 12,109
1 OriginalGriff 7,326
2 Peter Leow 5,003
3 Abhinav S 4,003
4 Maciej Los 3,575


Advertise | Privacy | Mobile
Web04 | 2.8.140421.2 | Last Updated 5 Mar 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid