Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to change the back colour of the clicked menu item of a menustrip .The menu item will change back to its default colours if other menu item gets clicked
Posted
Comments
Sergey Alexandrovich Kryukov 26-Feb-15 12:31pm    
Do you mean this class: System.Windows.Forms.MenuStrip? Anything else? Please, to greatly reduce the chance of misunderstanding and waste of time, always provide the full name of some types in question.
—SA
Member 11482855 26-Feb-15 13:06pm    
yes . I am new to the forum ...will surely try to give more descriptive questions from now

Use one of the events on the MenuStrip, like the Click event: https://msdn.microsoft.com/en-us/library/system.windows.forms.menustrip_events(v=vs.110).aspx[^]
 
Share this answer
 
Comments
Member 11482855 26-Feb-15 12:32pm    
I have tried a lot of those events ,but nothing worked for me. i have already worked out the hover colour with the Rendering.
But i need to highlight the clicked item of the menustrip.
ZurdoDev 26-Feb-15 12:39pm    
Perhaps you should post your code then and show us where you are stuck.
Member 11482855 26-Feb-15 13:02pm    
This code has no effect on my project
Dim normalColor As Color = SystemColors.Control
Dim highlightColor As Color = Color.FromArgb(91, 153, 153)

Private Sub MenuStrip1_Click(sender As Object, e As EventArgs) Handles MenuStrip1.Click
Dim gv As ToolStripButton = TryCast(sender, ToolStripButton)
OneToolStripMenuItem.BackColor = normalColor
TwoToolStripMenuItem.BackColor = normalColor
ThreeToolStripMenuItem.BackColor = normalColor
FourToolStripMenuItem.BackColor = normalColo
gv.BackColor = highlightColor
 
Share this answer
 
Comments
Member 11482855 27-Feb-15 9:49am    
Any answers on this one ....plz help !!!!

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