Click here to Skip to main content
15,905,558 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to change the background color of the menu when i click on it
Posted
Comments
Bikash Prakash Dash 7-May-13 8:58am    
can you please specify which control you are using.

Hey its me again. The border color is the same, but ForgegroundColor:

nameMenu.ForeColor = Color.YourColor;

NOTE: It's for all Windows Forms Toolbox items like buttons, menues, textbox and more.

It easy!

I hope I was helpful!

:)
 
Share this answer
 
v2
Comments
CHill60 7-May-13 12:41pm    
Just for infomation - it's generally considered a bit rude to post a second solution - use the Improve solution link if you have extra stuff to add. I've done this myself and had my wrist gently slapped too! :-)
sehs 7-May-13 12:48pm    
Thank you :)
Here is a code (ToolStripMenu):

C#
private void myToolStripMenuItem_Click(object sender, EventArgs e)
{
    myToolStripMenuItem.BackColor = Color.Red;
    myToolStripMenuItem.BackColor = Color.Green;
    myToolStripMenuItem.BackColor = Color.Blue;
    myToolStripMenuItem.BackColor = Color.Black;
    myToolStripMenuItem.BackColor = Color.White;
    myToolStripMenuItem.BackColor = Color.Gray;
    myToolStripMenuItem.BackColor = Color.Yellow;
    myToolStripMenuItem.BackColor = Color.Magenta;
    //and more
}

You can double-click it(the menu) and then write the ".BackColor or .BackgroundColor" = "Color._____".

If you using onother menu you must do the same: nameMenu.BackColor = Color.YourColor
 
Share this answer
 
Comments
sehs 7-May-13 12:04pm    
Thanks and how to change the border color of the menu ?
Same as solution 1, only I don't see what this has to do with comboboxes. I assume that you're using a ToolStripMenu:

C#
private void myToolStripMenuItem_Click(object sender, EventArgs e)
{
    myToolStripMenuItem.BackColor = Color.Red;
}
 
Share this answer
 
Comments
CHill60 7-May-13 12:43pm    
My +5. Succinct and actually answered the OP's question first
Try this my friend
Goto event properties of the combobox (Menu) double click on Mouse Click event
then use the following code.

C#
private void comboBox1_MouseClick(object sender, MouseEventArgs e)
        {
            comboBox1.BackColor = Color.Blue;
        }
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900