Click here to Skip to main content
13,087,932 members (64,681 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi Code Project readers,

I dont know how to change the background color of the toolstrip buttons when it is clicked...

I have 6 buttons in the toolstrip. when i click the 3rd button, that button alone need to be highlighted, till the next button is clicked.

Thanks in Advance.
Posted 10-Apr-13 1:08am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Step 1. Create click event handlers for each button.
Step 2. For the 5 buttons, add code that de-highlights button #3.
Step 3. On the handler for button #3, add code that highlights the button (and possibly de-highlights all the others)

Hope this is what you meant. :-)
Velrats 10-Apr-13 7:55am
yes i too know... but i need the exact code... I'm a newbie in programming.. so please dont hesitate to let me know the exact code for that...
i trying many but nothing works...
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

You need to assign below event as click event for all the toolstrip buttons.

Color NormalColor = SystemColors.Control;
Color HighlightColor = Color.Orange;
private void ToolStripButton_Click(object sender, EventArgs e)
    ToolStripButton tsbtnTemp = sender as ToolStripButton;
    toolStripButton1.BackColor = NormalColor;
    toolStripButton2.BackColor = NormalColor;
    toolStripButton3.BackColor = NormalColor;
    toolStripButton4.BackColor = NormalColor;
    toolStripButton5.BackColor = NormalColor;
    toolStripButton6.BackColor = NormalColor;
    tsbtnTemp.BackColor = HighlightColor;
Velrats 17-Apr-13 5:52am
Thanks a lot for the snippet... it works.... :)

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 | 2.8.170813.1 | Last Updated 17 Apr 2013
Copyright © CodeProject, 1999-2017
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