MenuStrip Help
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.

Hey Guys and Gals
I am making a .DLL and I seem to have an Issue with the Menustrip, If you see the Pic above and see that as you hover the Mouse over the Item to be Selected it produces a Blue Colour. I have gone through all the Menustrip Settings and can't seem to make it go away?, I am not sure if that's just how it's meant to be or can I adjust it's colour through coding?.
Also

The white area above Each Item, How can I sort that out aswell
ps, I have included the dll as an attachment, there is no coding on the dll, it's just the menustrip with the Items as in the pic above, So if someone could have a look for me that would be great..

Any Help would be grateful
Cheers
Chris
You do not have the required permissions to view the files attached to this post.
Last edited by hungryhounduk on Tue Jan 14, 2014 3:35 pm, edited 2 times in total.
Is the mouseover function available? If so it'd be quite easy.
Practice makes perfect!
VIP since: 6-10-2011
VIP since: 6-10-2011
i have no idea how you code looks like
but i made my own as well
and i used Color.Transparent
but i made my own as well
and i used Color.Transparent
Code: Select all
Public Overrides ReadOnly Property MenuItemSelectedGradientBegin() As Color 'mouse hover
Get
Return Color.Transparent
End Get
End Property
visit us on:
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
this.menuStrip1.BackColor = Color.FromKnownColor(KnownColor.Control); // Sets the color to the default instead of blue being the override; this mainly happens when the operating system changes it upon launching
Or set RenderMode to System if it's switched to manageRenderMode
Or if you're using the latest version of the program, the theme itself is defaulted to blue because it uses the 2003 office theme for most of its tools including the menustrip because it used to be the windows menu itself; but was later changed to the "Office Theme" Blue Style later on in the development process.
All three can be a solution, but the third just offers an answer to why and not the solution that you're looking for obviously.
Or go the hard route and declare a new Professional Table to overwrite everything:
ToolStrip.Renderer = new ToolStripProfessionalRenderer(new TanColorTable());
Depending on how you're program is layed out; it can also be this:
ToolStripManager.Renderer = new ToolStripProfessionalRenderer(new TanColorTable());
//Credits to JFO for Professional Render Table
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.Drawing;
using Microsoft.Win32;
using System.Runtime.InteropServices;
using System.Windows.Forms.VisualStyles;
using System.IO;
namespace Microsoft.Samples {
internal class TanColorTable : ProfessionalColorTable {
// Methods
public TanColorTable() {
}
internal Color FromKnownColor(TanColorTable.KnownColors color) {
return (Color)this.ColorTable[color];
}
internal static void InitTanLunaColors(ref Dictionary<TanColorTable.KnownColors, Color> rgbTable) {
rgbTable[TanColorTable.KnownColors.GripDark] = Color.FromArgb(0xc1, 190, 0xb3);
rgbTable[TanColorTable.KnownColors.SeparatorDark] = Color.FromArgb(0xc5, 0xc2, 0xb8);
rgbTable[TanColorTable.KnownColors.MenuItemSelected] = Color.FromArgb(0xc1, 210, 0xee);
rgbTable[TanColorTable.KnownColors.ButtonPressedBorder] = Color.FromArgb(0x31, 0x6a, 0xc5);
rgbTable[TanColorTable.KnownColors.CheckBackground] = Color.FromArgb(0xe1, 230, 0xe8);
rgbTable[TanColorTable.KnownColors.MenuItemBorder] = Color.FromArgb(0x31, 0x6a, 0xc5);
rgbTable[TanColorTable.KnownColors.CheckBackgroundMouseOver] = Color.FromArgb(0x31, 0x6a, 0xc5);
rgbTable[TanColorTable.KnownColors.MenuItemBorderMouseOver] = Color.FromArgb(0x4b, 0x4b, 0x6f);
rgbTable[TanColorTable.KnownColors.ToolStripDropDownBackground] = Color.FromArgb(0xfc, 0xfc, 0xf9);
rgbTable[TanColorTable.KnownColors.MenuBorder] = Color.FromArgb(0x8a, 0x86, 0x7a);
rgbTable[TanColorTable.KnownColors.SeparatorLight] = Color.FromArgb(0xff, 0xff, 0xff);
rgbTable[TanColorTable.KnownColors.ToolStripBorder] = Color.FromArgb(0xa3, 0xa3, 0x7c);
rgbTable[TanColorTable.KnownColors.MenuStripGradientBegin] = Color.FromArgb(0xe5, 0xe5, 0xd7);
rgbTable[TanColorTable.KnownColors.MenuStripGradientEnd] = Color.FromArgb(0xf4, 0xf2, 0xe8);
rgbTable[TanColorTable.KnownColors.ImageMarginGradientBegin] = Color.FromArgb(0xfe, 0xfe, 0xfb);
rgbTable[TanColorTable.KnownColors.ImageMarginGradientMiddle] = Color.FromArgb(0xec, 0xe7, 0xe0);
rgbTable[TanColorTable.KnownColors.ImageMarginGradientEnd] = Color.FromArgb(0xbd, 0xbd, 0xa3);
rgbTable[TanColorTable.KnownColors.OverflowButtonGradientBegin] = Color.FromArgb(0xf3, 0xf2, 240);
rgbTable[TanColorTable.KnownColors.OverflowButtonGradientMiddle] = Color.FromArgb(0xe2, 0xe1, 0xdb);
rgbTable[TanColorTable.KnownColors.OverflowButtonGradientEnd] = Color.FromArgb(0x92, 0x92, 0x76);
rgbTable[TanColorTable.KnownColors.MenuItemPressedGradientBegin] = Color.FromArgb(0xfc, 0xfc, 0xf9);
rgbTable[TanColorTable.KnownColors.MenuItemPressedGradientEnd] = Color.FromArgb(0xf6, 0xf4, 0xec);
rgbTable[TanColorTable.KnownColors.ImageMarginRevealedGradientBegin] = Color.FromArgb(0xf7, 0xf6, 0xef);
rgbTable[TanColorTable.KnownColors.ImageMarginRevealedGradientMiddle] = Color.FromArgb(0xf2, 240, 0xe4);
rgbTable[TanColorTable.KnownColors.ImageMarginRevealedGradientEnd] = Color.FromArgb(230, 0xe3, 210);
rgbTable[TanColorTable.KnownColors.ButtonCheckedGradientBegin] = Color.FromArgb(0xe1, 230, 0xe8);
rgbTable[TanColorTable.KnownColors.ButtonCheckedGradientMiddle] = Color.FromArgb(0xe1, 230, 0xe8);
rgbTable[TanColorTable.KnownColors.ButtonCheckedGradientEnd] = Color.FromArgb(0xe1, 230, 0xe8);
rgbTable[TanColorTable.KnownColors.ButtonSelectedGradientBegin] = Color.FromArgb(0xc1, 210, 0xee);
rgbTable[TanColorTable.KnownColors.ButtonSelectedGradientMiddle] = Color.FromArgb(0xc1, 210, 0xee);
rgbTable[TanColorTable.KnownColors.ButtonSelectedGradientEnd] = Color.FromArgb(0xc1, 210, 0xee);
rgbTable[TanColorTable.KnownColors.ButtonPressedGradientBegin] = Color.FromArgb(0x98, 0xb5, 0xe2);
rgbTable[TanColorTable.KnownColors.ButtonPressedGradientMiddle] = Color.FromArgb(0x98, 0xb5, 0xe2);
rgbTable[TanColorTable.KnownColors.ButtonPressedGradientEnd] = Color.FromArgb(0x98, 0xb5, 0xe2);
rgbTable[TanColorTable.KnownColors.GripLight] = Color.FromArgb(0xff, 0xff, 0xff);
}
public override Color ButtonCheckedGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonCheckedGradientBegin);
}
return base.ButtonCheckedGradientBegin;
}
}
public override Color ButtonCheckedGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonCheckedGradientEnd);
}
return base.ButtonCheckedGradientEnd;
}
}
public override Color ButtonCheckedGradientMiddle {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonCheckedGradientMiddle);
}
return base.ButtonCheckedGradientMiddle;
}
}
public override Color ButtonPressedBorder {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonPressedBorder);
}
return base.ButtonPressedBorder;
}
}
public override Color ButtonPressedGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonPressedGradientBegin);
}
return base.ButtonPressedGradientBegin;
}
}
public override Color ButtonPressedGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonPressedGradientEnd);
}
return base.ButtonPressedGradientEnd;
}
}
public override Color ButtonPressedGradientMiddle {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonPressedGradientMiddle);
}
return base.ButtonPressedGradientMiddle;
}
}
public override Color ButtonSelectedBorder {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonPressedBorder);
}
return base.ButtonSelectedBorder;
}
}
public override Color ButtonSelectedGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonSelectedGradientBegin);
}
return base.ButtonSelectedGradientBegin;
}
}
public override Color ButtonSelectedGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonSelectedGradientEnd);
}
return base.ButtonSelectedGradientEnd;
}
}
public override Color ButtonSelectedGradientMiddle {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonSelectedGradientMiddle);
}
return base.ButtonSelectedGradientMiddle;
}
}
public override Color CheckBackground {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.CheckBackground);
}
return base.CheckBackground;
}
}
public override Color CheckPressedBackground {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.CheckBackgroundMouseOver);
}
return base.CheckPressedBackground;
}
}
public override Color CheckSelectedBackground {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.CheckBackgroundMouseOver);
}
return base.CheckSelectedBackground;
}
}
internal static string ColorScheme {
get {
return TanColorTable.DisplayInformation.ColorScheme;
}
}
private Dictionary<KnownColors,Color> ColorTable {
get {
if (this.tanRGB == null) {
this.tanRGB = new Dictionary<KnownColors,Color>((int)KnownColors.LastKnownColor);
TanColorTable.InitTanLunaColors(ref this.tanRGB);
}
return this.tanRGB;
}
}
public override Color GripDark {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.GripDark);
}
return base.GripDark;
}
}
public override Color GripLight {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.GripLight);
}
return base.GripLight;
}
}
public override Color ImageMarginGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ImageMarginGradientBegin);
}
return base.ImageMarginGradientBegin;
}
}
public override Color ImageMarginGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ImageMarginGradientEnd);
}
return base.ImageMarginGradientEnd;
}
}
public override Color ImageMarginGradientMiddle {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ImageMarginGradientMiddle);
}
return base.ImageMarginGradientMiddle;
}
}
public override Color ImageMarginRevealedGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ImageMarginRevealedGradientBegin);
}
return base.ImageMarginRevealedGradientBegin;
}
}
public override Color ImageMarginRevealedGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ImageMarginRevealedGradientEnd);
}
return base.ImageMarginRevealedGradientEnd;
}
}
public override Color ImageMarginRevealedGradientMiddle {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ImageMarginRevealedGradientMiddle);
}
return base.ImageMarginRevealedGradientMiddle;
}
}
public override Color MenuBorder {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.MenuBorder);
}
return base.MenuItemBorder;
}
}
public override Color MenuItemBorder {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.MenuItemBorder);
}
return base.MenuItemBorder;
}
}
public override Color MenuItemPressedGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.MenuItemPressedGradientBegin);
}
return base.MenuItemPressedGradientBegin;
}
}
public override Color MenuItemPressedGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.MenuItemPressedGradientEnd);
}
return base.MenuItemPressedGradientEnd;
}
}
public override Color MenuItemPressedGradientMiddle {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ImageMarginRevealedGradientMiddle);
}
return base.MenuItemPressedGradientMiddle;
}
}
public override Color MenuItemSelected {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.MenuItemSelected);
}
return base.MenuItemSelected;
}
}
public override Color MenuItemSelectedGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonSelectedGradientBegin);
}
return base.MenuItemSelectedGradientBegin;
}
}
public override Color MenuItemSelectedGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonSelectedGradientEnd);
}
return base.MenuItemSelectedGradientEnd;
}
}
public override Color MenuStripGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.MenuStripGradientBegin);
}
return base.MenuStripGradientBegin;
}
}
public override Color MenuStripGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.MenuStripGradientEnd);
}
return base.MenuStripGradientEnd;
}
}
public override Color OverflowButtonGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.OverflowButtonGradientBegin);
}
return base.OverflowButtonGradientBegin;
}
}
public override Color OverflowButtonGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.OverflowButtonGradientEnd);
}
return base.OverflowButtonGradientEnd;
}
}
public override Color OverflowButtonGradientMiddle {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.OverflowButtonGradientMiddle);
}
return base.OverflowButtonGradientMiddle;
}
}
public override Color RaftingContainerGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.MenuStripGradientBegin);
}
return base.RaftingContainerGradientBegin;
}
}
public override Color RaftingContainerGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.MenuStripGradientEnd);
}
return base.RaftingContainerGradientEnd;
}
}
public override Color SeparatorDark {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.SeparatorDark);
}
return base.SeparatorDark;
}
}
public override Color SeparatorLight {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.SeparatorLight);
}
return base.SeparatorLight;
}
}
public override Color ToolStripBorder {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ToolStripBorder);
}
return base.ToolStripBorder;
}
}
public override Color ToolStripDropDownBackground {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ToolStripDropDownBackground);
}
return base.ToolStripDropDownBackground;
}
}
public override Color ToolStripGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ImageMarginGradientBegin);
}
return base.ToolStripGradientBegin;
}
}
public override Color ToolStripGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ImageMarginGradientEnd);
}
return base.ToolStripGradientEnd;
}
}
public override Color ToolStripGradientMiddle {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ImageMarginGradientMiddle);
}
return base.ToolStripGradientMiddle;
}
}
private bool UseBaseColorTable {
get {
bool flag1 = !TanColorTable.DisplayInformation.IsLunaTheme || ((TanColorTable.ColorScheme != "HomeStead") && (TanColorTable.ColorScheme != "NormalColor"));
if (flag1 && (this.tanRGB != null)) {
this.tanRGB.Clear();
this.tanRGB = null;
}
return flag1;
}
}
// Fields
private const string blueColorScheme = "NormalColor";
private const string oliveColorScheme = "HomeStead";
private const string silverColorScheme = "Metallic";
private Dictionary<TanColorTable.KnownColors, Color> tanRGB;
// Nested Types
private static class DisplayInformation {
// Methods
static DisplayInformation() {
SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(TanColorTable.DisplayInformation.OnUserPreferenceChanged);
TanColorTable.DisplayInformation.SetScheme();
}
private static void OnUserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e) {
TanColorTable.DisplayInformation.SetScheme();
}
private static void SetScheme() {
TanColorTable.DisplayInformation.isLunaTheme = false;
if (VisualStyleRenderer.IsSupported) {
DisplayInformation.colorScheme = VisualStyleInformation.ColorScheme;
if (!VisualStyleInformation.IsEnabledByUser) {
return;
}
StringBuilder builder1 = new StringBuilder(0x200);
GetCurrentThemeName(builder1, builder1.Capacity, null, 0, null, 0);
string text1 = builder1.ToString();
TanColorTable.DisplayInformation.isLunaTheme = string.Equals("luna.msstyles", Path.GetFileName(text1), StringComparison.InvariantCultureIgnoreCase);
}
else {
TanColorTable.DisplayInformation.colorScheme = null;
}
}
// Properties
public static string ColorScheme {
get {
return colorScheme;
}
}
internal static bool IsLunaTheme {
get {
return isLunaTheme;
}
}
// Fields
[ThreadStatic]
private static string colorScheme;
[ThreadStatic]
private static bool isLunaTheme;
private const string lunaFileName = "luna.msstyles";
[DllImport("uxtheme.dll", CharSet = CharSet.Auto)]
public static extern int GetCurrentThemeName(StringBuilder pszThemeFileName, int dwMaxNameChars, StringBuilder pszColorBuff, int dwMaxColorChars, StringBuilder pszSizeBuff, int cchMaxSizeChars);
}
internal enum KnownColors {
ButtonPressedBorder,
MenuItemBorder,
MenuItemBorderMouseOver,
MenuItemSelected,
CheckBackground,
CheckBackgroundMouseOver,
GripDark,
GripLight,
MenuStripGradientBegin,
MenuStripGradientEnd,
ImageMarginRevealedGradientBegin,
ImageMarginRevealedGradientEnd,
ImageMarginRevealedGradientMiddle,
MenuItemPressedGradientBegin,
MenuItemPressedGradientEnd,
ButtonPressedGradientBegin,
ButtonPressedGradientEnd,
ButtonPressedGradientMiddle,
ButtonSelectedGradientBegin,
ButtonSelectedGradientEnd,
ButtonSelectedGradientMiddle,
OverflowButtonGradientBegin,
OverflowButtonGradientEnd,
OverflowButtonGradientMiddle,
ButtonCheckedGradientBegin,
ButtonCheckedGradientEnd,
ButtonCheckedGradientMiddle,
ImageMarginGradientBegin,
ImageMarginGradientEnd,
ImageMarginGradientMiddle,
MenuBorder,
ToolStripDropDownBackground,
ToolStripBorder,
SeparatorDark,
SeparatorLight,
LastKnownColor = SeparatorLight,
}
}
}
This bit of code written by JFO will replace everything to the old style of VS making the color customizable and changeable once more like the old version given out before.
Or set RenderMode to System if it's switched to manageRenderMode
Or if you're using the latest version of the program, the theme itself is defaulted to blue because it uses the 2003 office theme for most of its tools including the menustrip because it used to be the windows menu itself; but was later changed to the "Office Theme" Blue Style later on in the development process.
All three can be a solution, but the third just offers an answer to why and not the solution that you're looking for obviously.
Or go the hard route and declare a new Professional Table to overwrite everything:
ToolStrip.Renderer = new ToolStripProfessionalRenderer(new TanColorTable());
Depending on how you're program is layed out; it can also be this:
ToolStripManager.Renderer = new ToolStripProfessionalRenderer(new TanColorTable());
//Credits to JFO for Professional Render Table
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.Drawing;
using Microsoft.Win32;
using System.Runtime.InteropServices;
using System.Windows.Forms.VisualStyles;
using System.IO;
namespace Microsoft.Samples {
internal class TanColorTable : ProfessionalColorTable {
// Methods
public TanColorTable() {
}
internal Color FromKnownColor(TanColorTable.KnownColors color) {
return (Color)this.ColorTable[color];
}
internal static void InitTanLunaColors(ref Dictionary<TanColorTable.KnownColors, Color> rgbTable) {
rgbTable[TanColorTable.KnownColors.GripDark] = Color.FromArgb(0xc1, 190, 0xb3);
rgbTable[TanColorTable.KnownColors.SeparatorDark] = Color.FromArgb(0xc5, 0xc2, 0xb8);
rgbTable[TanColorTable.KnownColors.MenuItemSelected] = Color.FromArgb(0xc1, 210, 0xee);
rgbTable[TanColorTable.KnownColors.ButtonPressedBorder] = Color.FromArgb(0x31, 0x6a, 0xc5);
rgbTable[TanColorTable.KnownColors.CheckBackground] = Color.FromArgb(0xe1, 230, 0xe8);
rgbTable[TanColorTable.KnownColors.MenuItemBorder] = Color.FromArgb(0x31, 0x6a, 0xc5);
rgbTable[TanColorTable.KnownColors.CheckBackgroundMouseOver] = Color.FromArgb(0x31, 0x6a, 0xc5);
rgbTable[TanColorTable.KnownColors.MenuItemBorderMouseOver] = Color.FromArgb(0x4b, 0x4b, 0x6f);
rgbTable[TanColorTable.KnownColors.ToolStripDropDownBackground] = Color.FromArgb(0xfc, 0xfc, 0xf9);
rgbTable[TanColorTable.KnownColors.MenuBorder] = Color.FromArgb(0x8a, 0x86, 0x7a);
rgbTable[TanColorTable.KnownColors.SeparatorLight] = Color.FromArgb(0xff, 0xff, 0xff);
rgbTable[TanColorTable.KnownColors.ToolStripBorder] = Color.FromArgb(0xa3, 0xa3, 0x7c);
rgbTable[TanColorTable.KnownColors.MenuStripGradientBegin] = Color.FromArgb(0xe5, 0xe5, 0xd7);
rgbTable[TanColorTable.KnownColors.MenuStripGradientEnd] = Color.FromArgb(0xf4, 0xf2, 0xe8);
rgbTable[TanColorTable.KnownColors.ImageMarginGradientBegin] = Color.FromArgb(0xfe, 0xfe, 0xfb);
rgbTable[TanColorTable.KnownColors.ImageMarginGradientMiddle] = Color.FromArgb(0xec, 0xe7, 0xe0);
rgbTable[TanColorTable.KnownColors.ImageMarginGradientEnd] = Color.FromArgb(0xbd, 0xbd, 0xa3);
rgbTable[TanColorTable.KnownColors.OverflowButtonGradientBegin] = Color.FromArgb(0xf3, 0xf2, 240);
rgbTable[TanColorTable.KnownColors.OverflowButtonGradientMiddle] = Color.FromArgb(0xe2, 0xe1, 0xdb);
rgbTable[TanColorTable.KnownColors.OverflowButtonGradientEnd] = Color.FromArgb(0x92, 0x92, 0x76);
rgbTable[TanColorTable.KnownColors.MenuItemPressedGradientBegin] = Color.FromArgb(0xfc, 0xfc, 0xf9);
rgbTable[TanColorTable.KnownColors.MenuItemPressedGradientEnd] = Color.FromArgb(0xf6, 0xf4, 0xec);
rgbTable[TanColorTable.KnownColors.ImageMarginRevealedGradientBegin] = Color.FromArgb(0xf7, 0xf6, 0xef);
rgbTable[TanColorTable.KnownColors.ImageMarginRevealedGradientMiddle] = Color.FromArgb(0xf2, 240, 0xe4);
rgbTable[TanColorTable.KnownColors.ImageMarginRevealedGradientEnd] = Color.FromArgb(230, 0xe3, 210);
rgbTable[TanColorTable.KnownColors.ButtonCheckedGradientBegin] = Color.FromArgb(0xe1, 230, 0xe8);
rgbTable[TanColorTable.KnownColors.ButtonCheckedGradientMiddle] = Color.FromArgb(0xe1, 230, 0xe8);
rgbTable[TanColorTable.KnownColors.ButtonCheckedGradientEnd] = Color.FromArgb(0xe1, 230, 0xe8);
rgbTable[TanColorTable.KnownColors.ButtonSelectedGradientBegin] = Color.FromArgb(0xc1, 210, 0xee);
rgbTable[TanColorTable.KnownColors.ButtonSelectedGradientMiddle] = Color.FromArgb(0xc1, 210, 0xee);
rgbTable[TanColorTable.KnownColors.ButtonSelectedGradientEnd] = Color.FromArgb(0xc1, 210, 0xee);
rgbTable[TanColorTable.KnownColors.ButtonPressedGradientBegin] = Color.FromArgb(0x98, 0xb5, 0xe2);
rgbTable[TanColorTable.KnownColors.ButtonPressedGradientMiddle] = Color.FromArgb(0x98, 0xb5, 0xe2);
rgbTable[TanColorTable.KnownColors.ButtonPressedGradientEnd] = Color.FromArgb(0x98, 0xb5, 0xe2);
rgbTable[TanColorTable.KnownColors.GripLight] = Color.FromArgb(0xff, 0xff, 0xff);
}
public override Color ButtonCheckedGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonCheckedGradientBegin);
}
return base.ButtonCheckedGradientBegin;
}
}
public override Color ButtonCheckedGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonCheckedGradientEnd);
}
return base.ButtonCheckedGradientEnd;
}
}
public override Color ButtonCheckedGradientMiddle {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonCheckedGradientMiddle);
}
return base.ButtonCheckedGradientMiddle;
}
}
public override Color ButtonPressedBorder {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonPressedBorder);
}
return base.ButtonPressedBorder;
}
}
public override Color ButtonPressedGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonPressedGradientBegin);
}
return base.ButtonPressedGradientBegin;
}
}
public override Color ButtonPressedGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonPressedGradientEnd);
}
return base.ButtonPressedGradientEnd;
}
}
public override Color ButtonPressedGradientMiddle {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonPressedGradientMiddle);
}
return base.ButtonPressedGradientMiddle;
}
}
public override Color ButtonSelectedBorder {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonPressedBorder);
}
return base.ButtonSelectedBorder;
}
}
public override Color ButtonSelectedGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonSelectedGradientBegin);
}
return base.ButtonSelectedGradientBegin;
}
}
public override Color ButtonSelectedGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonSelectedGradientEnd);
}
return base.ButtonSelectedGradientEnd;
}
}
public override Color ButtonSelectedGradientMiddle {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonSelectedGradientMiddle);
}
return base.ButtonSelectedGradientMiddle;
}
}
public override Color CheckBackground {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.CheckBackground);
}
return base.CheckBackground;
}
}
public override Color CheckPressedBackground {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.CheckBackgroundMouseOver);
}
return base.CheckPressedBackground;
}
}
public override Color CheckSelectedBackground {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.CheckBackgroundMouseOver);
}
return base.CheckSelectedBackground;
}
}
internal static string ColorScheme {
get {
return TanColorTable.DisplayInformation.ColorScheme;
}
}
private Dictionary<KnownColors,Color> ColorTable {
get {
if (this.tanRGB == null) {
this.tanRGB = new Dictionary<KnownColors,Color>((int)KnownColors.LastKnownColor);
TanColorTable.InitTanLunaColors(ref this.tanRGB);
}
return this.tanRGB;
}
}
public override Color GripDark {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.GripDark);
}
return base.GripDark;
}
}
public override Color GripLight {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.GripLight);
}
return base.GripLight;
}
}
public override Color ImageMarginGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ImageMarginGradientBegin);
}
return base.ImageMarginGradientBegin;
}
}
public override Color ImageMarginGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ImageMarginGradientEnd);
}
return base.ImageMarginGradientEnd;
}
}
public override Color ImageMarginGradientMiddle {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ImageMarginGradientMiddle);
}
return base.ImageMarginGradientMiddle;
}
}
public override Color ImageMarginRevealedGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ImageMarginRevealedGradientBegin);
}
return base.ImageMarginRevealedGradientBegin;
}
}
public override Color ImageMarginRevealedGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ImageMarginRevealedGradientEnd);
}
return base.ImageMarginRevealedGradientEnd;
}
}
public override Color ImageMarginRevealedGradientMiddle {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ImageMarginRevealedGradientMiddle);
}
return base.ImageMarginRevealedGradientMiddle;
}
}
public override Color MenuBorder {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.MenuBorder);
}
return base.MenuItemBorder;
}
}
public override Color MenuItemBorder {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.MenuItemBorder);
}
return base.MenuItemBorder;
}
}
public override Color MenuItemPressedGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.MenuItemPressedGradientBegin);
}
return base.MenuItemPressedGradientBegin;
}
}
public override Color MenuItemPressedGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.MenuItemPressedGradientEnd);
}
return base.MenuItemPressedGradientEnd;
}
}
public override Color MenuItemPressedGradientMiddle {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ImageMarginRevealedGradientMiddle);
}
return base.MenuItemPressedGradientMiddle;
}
}
public override Color MenuItemSelected {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.MenuItemSelected);
}
return base.MenuItemSelected;
}
}
public override Color MenuItemSelectedGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonSelectedGradientBegin);
}
return base.MenuItemSelectedGradientBegin;
}
}
public override Color MenuItemSelectedGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ButtonSelectedGradientEnd);
}
return base.MenuItemSelectedGradientEnd;
}
}
public override Color MenuStripGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.MenuStripGradientBegin);
}
return base.MenuStripGradientBegin;
}
}
public override Color MenuStripGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.MenuStripGradientEnd);
}
return base.MenuStripGradientEnd;
}
}
public override Color OverflowButtonGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.OverflowButtonGradientBegin);
}
return base.OverflowButtonGradientBegin;
}
}
public override Color OverflowButtonGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.OverflowButtonGradientEnd);
}
return base.OverflowButtonGradientEnd;
}
}
public override Color OverflowButtonGradientMiddle {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.OverflowButtonGradientMiddle);
}
return base.OverflowButtonGradientMiddle;
}
}
public override Color RaftingContainerGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.MenuStripGradientBegin);
}
return base.RaftingContainerGradientBegin;
}
}
public override Color RaftingContainerGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.MenuStripGradientEnd);
}
return base.RaftingContainerGradientEnd;
}
}
public override Color SeparatorDark {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.SeparatorDark);
}
return base.SeparatorDark;
}
}
public override Color SeparatorLight {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.SeparatorLight);
}
return base.SeparatorLight;
}
}
public override Color ToolStripBorder {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ToolStripBorder);
}
return base.ToolStripBorder;
}
}
public override Color ToolStripDropDownBackground {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ToolStripDropDownBackground);
}
return base.ToolStripDropDownBackground;
}
}
public override Color ToolStripGradientBegin {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ImageMarginGradientBegin);
}
return base.ToolStripGradientBegin;
}
}
public override Color ToolStripGradientEnd {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ImageMarginGradientEnd);
}
return base.ToolStripGradientEnd;
}
}
public override Color ToolStripGradientMiddle {
get {
if (!this.UseBaseColorTable) {
return this.FromKnownColor(TanColorTable.KnownColors.ImageMarginGradientMiddle);
}
return base.ToolStripGradientMiddle;
}
}
private bool UseBaseColorTable {
get {
bool flag1 = !TanColorTable.DisplayInformation.IsLunaTheme || ((TanColorTable.ColorScheme != "HomeStead") && (TanColorTable.ColorScheme != "NormalColor"));
if (flag1 && (this.tanRGB != null)) {
this.tanRGB.Clear();
this.tanRGB = null;
}
return flag1;
}
}
// Fields
private const string blueColorScheme = "NormalColor";
private const string oliveColorScheme = "HomeStead";
private const string silverColorScheme = "Metallic";
private Dictionary<TanColorTable.KnownColors, Color> tanRGB;
// Nested Types
private static class DisplayInformation {
// Methods
static DisplayInformation() {
SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(TanColorTable.DisplayInformation.OnUserPreferenceChanged);
TanColorTable.DisplayInformation.SetScheme();
}
private static void OnUserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e) {
TanColorTable.DisplayInformation.SetScheme();
}
private static void SetScheme() {
TanColorTable.DisplayInformation.isLunaTheme = false;
if (VisualStyleRenderer.IsSupported) {
DisplayInformation.colorScheme = VisualStyleInformation.ColorScheme;
if (!VisualStyleInformation.IsEnabledByUser) {
return;
}
StringBuilder builder1 = new StringBuilder(0x200);
GetCurrentThemeName(builder1, builder1.Capacity, null, 0, null, 0);
string text1 = builder1.ToString();
TanColorTable.DisplayInformation.isLunaTheme = string.Equals("luna.msstyles", Path.GetFileName(text1), StringComparison.InvariantCultureIgnoreCase);
}
else {
TanColorTable.DisplayInformation.colorScheme = null;
}
}
// Properties
public static string ColorScheme {
get {
return colorScheme;
}
}
internal static bool IsLunaTheme {
get {
return isLunaTheme;
}
}
// Fields
[ThreadStatic]
private static string colorScheme;
[ThreadStatic]
private static bool isLunaTheme;
private const string lunaFileName = "luna.msstyles";
[DllImport("uxtheme.dll", CharSet = CharSet.Auto)]
public static extern int GetCurrentThemeName(StringBuilder pszThemeFileName, int dwMaxNameChars, StringBuilder pszColorBuff, int dwMaxColorChars, StringBuilder pszSizeBuff, int cchMaxSizeChars);
}
internal enum KnownColors {
ButtonPressedBorder,
MenuItemBorder,
MenuItemBorderMouseOver,
MenuItemSelected,
CheckBackground,
CheckBackgroundMouseOver,
GripDark,
GripLight,
MenuStripGradientBegin,
MenuStripGradientEnd,
ImageMarginRevealedGradientBegin,
ImageMarginRevealedGradientEnd,
ImageMarginRevealedGradientMiddle,
MenuItemPressedGradientBegin,
MenuItemPressedGradientEnd,
ButtonPressedGradientBegin,
ButtonPressedGradientEnd,
ButtonPressedGradientMiddle,
ButtonSelectedGradientBegin,
ButtonSelectedGradientEnd,
ButtonSelectedGradientMiddle,
OverflowButtonGradientBegin,
OverflowButtonGradientEnd,
OverflowButtonGradientMiddle,
ButtonCheckedGradientBegin,
ButtonCheckedGradientEnd,
ButtonCheckedGradientMiddle,
ImageMarginGradientBegin,
ImageMarginGradientEnd,
ImageMarginGradientMiddle,
MenuBorder,
ToolStripDropDownBackground,
ToolStripBorder,
SeparatorDark,
SeparatorLight,
LastKnownColor = SeparatorLight,
}
}
}
This bit of code written by JFO will replace everything to the old style of VS making the color customizable and changeable once more like the old version given out before.
Wow!
That was some Paste
Sorry but that is all double dutch to me
I am more a Designer than a Coder and that just Fried my Brain looking at it..
But thanks alot for the time and effort to post that all up
If someone could talk me through changing to that above, that would be great.
I am using VB2010 Pro
Cheers
Chris
That was some Paste

Sorry but that is all double dutch to me

But thanks alot for the time and effort to post that all up
If someone could talk me through changing to that above, that would be great.
I am using VB2010 Pro
Cheers
Chris
Why not create a MenuStripRenderer like this
Code: Select all
Obviously this is very limited, but you can easily expand it. By using a Renderer you can change everything about a MenuStrip.Public Class MyRenderer : Inherits ToolStripRenderer
Protected Overrides Sub OnRenderMenuItemBackground(ByVal e As System.Windows.Forms.ToolStripItemRenderEventArgs)
Using ItemBrush As SolidBrush = New SolidBrush(YOUR COLOR HERE)
If e.Item.Selected Then
e.Graphics.FillRectangle(ItemBrush, 0, 0, e.Item.Width, e.Item.Height)
End If
End Using
End Sub
End Class
Last edited by XTechVB on Tue Jan 14, 2014 4:21 pm, edited 1 time in total.
You can find me on Facebook or on Skype mihai_92b
Hey Chris, if you give me your skype then I can try to help you via teamviewer (skype for the easier way of chatting).
Practice makes perfect!
VIP since: 6-10-2011
VIP since: 6-10-2011
Hi Clanc789
I dont have Skype( actually i do but not on this computer and I have forgotten my Username and Password) :(
Chris
I dont have Skype( actually i do but not on this computer and I have forgotten my Username and Password) :(
Chris
Copyright Information
Copyright © Codenstuff.com 2020 - 2023