הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
Question
Saturday, December 24, 2011 12:07 AM
How do you change Color of all the ToolStripMenuItem on a Windows form. It seems as though you can't.
Here is the code that fails
For Each a In Me.ToolStripItems Then
a.BackColor = System.Drawing.ColorTranslator.FromOle(InterfaceColor)
a.ForeColor = System.Drawing.ColorTranslator.FromOle(LabelColor)
Next
Marc Menzel
All replies (4)
Saturday, December 24, 2011 11:57 AM ✅Answered
Hi Marc..
Welcome to MSDN Forums..
Did you follow Paul's code? I hope Paul code is enough for you..
I have found some usefull information for you..
Check this..
http://social.msdn.microsoft.com/Forums/ar/winforms/thread/2492c798-63ed-44f2-a9b7-39f197893210
http://www.codeproject.com/Questions/165100/How-to-change-background-color-of-menustrip-in-win
By
A Pathfinder..
JoSwa
If you find an answer helpful, click the helpful button. If you find an answer to your question, mark it as the answer.
Saturday, December 24, 2011 12:45 PM ✅Answered
My best answer:
For Each Control As Control In Me.Controls
If Control.GetType.ToString = "System.Windows.Forms.MenuStrip" Then
Dim MenuStrip As New MenuStrip
MenuStrip = CType(Control, MenuStrip)
For Each ToolStripMenuItem As ToolStripMenuItem In MenuStrip.Items
ToolStripMenuItem.BackColor = Color.Red
ToolStripMenuItem.ForeColor = Color.Blue
For Each DropDownItem As ToolStripDropDownItem In ToolStripMenuItem.DropDownItems
DropDownItem.BackColor = Color.Red
DropDownItem.ForeColor = Color.Blue
Next
Next
End If
Next
If you want something you've never had, you need to do something you've never done.
Saturday, December 24, 2011 12:19 AM
try this, just switch it up to what you need it to be....
For Each ToolStripMenuItem As ToolStripMenuItem In MenuStrip1.Items
ToolStripMenuItem.BackColor = Color.Red
ToolStripMenuItem.ForeColor = Color.Yellow
Next
For Each a As ToolStripMenuItem In MenuStrip1.Items
a.BackColor = System.Drawing.ColorTranslator.FromOle(InterfaceColor)
a.ForeColor = System.Drawing.ColorTranslator.FromOle(LabelColor)
Next
If you want something you've never had, you need to do something you've never done.
Wednesday, December 28, 2011 6:30 AM
Hi Marc,
Welcome to the MSDN Forum.
Do you have any updates?
If you have any concerns, please feel free to follow up.
Best regards,
Mike Feng
MSDN Community Support | Feedback to us
Please remember to mark the replies as answers if they help and unmark them if they provide no help.