Click here to Skip to main content
11,934,809 members (47,283 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# Windows Forms
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 2: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. Smile | :)
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 | Mobile
Web02 | 2.8.151126.1 | Last Updated 17 Apr 2013
Copyright © CodeProject, 1999-2015
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