MainMenu Colour

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I change a main menu's colour ?
It appears white in the design view but when i run the app it is grey.
 
* =?Utf-8?B?dmVkYW50XzE1?= said:
How can I change a main menu's colour ?
It appears white in the design view but when i run the app it is grey.

Taken from a post by Joachim Fuchs:

\\\
private void menuItem1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
{
System.Drawing.Drawing2D.LinearGradientBrush brush =
new System.Drawing.Drawing2D.LinearGradientBrush(new Point(0,0), new Point(1300,0), Color.DarkGreen, Color.White);
e.Graphics.FillRectangle(brush, e.Bounds.Left, e.Bounds.Top, 1300, e.Bounds.Height);
brush.Dispose();
}
///
 
I need the code for VB. This is for (i think) c#.
anyone who can translate or know how to change the menucolour to vb.
private void menuItem1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
{
System.Drawing.Drawing2D.LinearGradientBrush brush =
new System.Drawing.Drawing2D.LinearGradientBrush(new Point(0,0), new Point(1300,0), Color.DarkGreen, Color.White);
e.Graphics.FillRectangle(brush, e.Bounds.Left, e.Bounds.Top, 1300, e.Bounds.Height);
brush.Dispose();
}

--
There are 10 types of people. Those who understand binary and those who dont.

Vedant Lath
 
This will translate for you.

http://authors.aspalliance.com/aldotnet/examples/translate.aspx


--
Brian P. Hammer
I need the code for VB. This is for (i think) c#.
anyone who can translate or know how to change the menucolour to vb.
private void menuItem1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
{
System.Drawing.Drawing2D.LinearGradientBrush brush =
new System.Drawing.Drawing2D.LinearGradientBrush(new Point(0,0), new Point(1300,0), Color.DarkGreen, Color.White);
e.Graphics.FillRectangle(brush, e.Bounds.Left, e.Bounds.Top, 1300, e.Bounds.Height);
brush.Dispose();
}

--
There are 10 types of people. Those who understand binary and those who dont.

Vedant Lath
 
I have added a dummy menuitem (with no function and text) to the mainmenu and use the codes to handle it and draw the mainmenu with colour.
But the other menu items in the mainmenu are disappeared until mouse over and they are in grey. How to solve it?

Thanks!
 
Back
Top