2013-03-04 102 views
2

我犯了這樣的一種形式(C#語言 - VisualStudio2012):
http://i.stack.imgur.com/5GEY1.jpg
我怎樣才能改變toolstripmenuitem的邊框顏色從白色到另一個,或禁用它?
代碼:如何更改toolstripmenuitem邊框顏色?

class CustomProfessionalColors : ProfessionalColorTable 
{ 
    public override Color MenuItemSelected 
    { get { return Color.FromArgb(51, 51, 52); } } 

    public override Color MenuBorder 
    { get { return Color.Black; } } 

    //fill màu item của menu khi mouse enter 
    public override Color MenuItemSelectedGradientBegin 
    { get { return Color.FromArgb(64, 64, 66); } } 

    public override Color MenuItemSelectedGradientEnd 
    { get { return Color.FromArgb(64, 64, 66); } } 

    // chọn màu viền menu item khi mouse enter 
    public override Color MenuItemBorder 
    { get { return Color.FromArgb(51, 51, 52); } } 

    // fill màu nút item của menu khi dc nhấn 
    public override Color MenuItemPressedGradientBegin 
    { get { return Color.FromArgb(27, 27, 28); } } 

    public override Color MenuItemPressedGradientEnd 
    { get { return Color.FromArgb(27, 27, 28); } } 

    // fill màu thanh menu strip 
    public override Color MenuStripGradientBegin 
    { get { return Color.FromArgb(51, 51, 52); } } 

    public override Color MenuStripGradientEnd  
    { get { return Color.FromArgb(51, 51, 52); } } 
} 

public Form1() 
    { 
     InitializeComponent(); 
     menuStrip1.Renderer = new ToolStripProfessionalRenderer(new CustomProfessionalColors());  
    } 
+0

語言?框架?代碼? – Oren 2013-03-04 17:51:26

+0

我已經添加了它 – 2013-03-05 03:43:18

回答

0

這將做的工作。 它實際上不是邊框,而是背景。

public override Color ToolStripDropDownBackground { 
    get { return Color.Red; } 
}