如何改变我在menustrip的边界 [英] how to change my border in menustrip

查看:81
本文介绍了如何改变我在menustrip的边界的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是:我做了一个像(文件)这样的菜单来自它的很多项目,比如(New-Edit - ,,,)当我改变颜色时背景颜色为例红色项目不会更改颜色,所以我改变每个项目的背面颜色,但它也有一个白色边框,这是我的代码



my problem is : i made a menu like (File) and come from it many items like (New-Edit-,,,) when i change the color the background color to be by example Red the items won''t change the color so i change the back color of every item but it have a white border also and this is my code

public partial class Start_Page : Form
    {
        public Start_Page()
        {
            InitializeComponent();
            menuStrip1.Renderer = new MyRenderer();



        }

        private class MyRenderer : ToolStripProfessionalRenderer
        {
            public MyRenderer() : base(new MyColors()) { }
        }

        private class MyColors : ProfessionalColorTable
        {
            public override Color MenuItemSelected
            {
                get { return Color.FromArgb(11, 126, 222); }
            }
            public override Color MenuItemSelectedGradientBegin
            {
                get { return Color.FromArgb(11, 126, 222); }
            }
            public override Color MenuItemSelectedGradientEnd
            {
                get { return Color.FromArgb(11, 126, 222); }
            }
            public override Color MenuItemPressedGradientBegin
            {
                get{ return Color.FromArgb(8, 64, 101); }
            }
            public override Color MenuItemPressedGradientEnd
            {
                get { return Color.FromArgb(8, 64, 101); }
            }
            public override Color MenuBorder
            {
                get
                {
                    return Color.Blue;
                }
            }
            public override Color MenuItemBorder
            {
                get
                {
                    return Color.Blue;
                }
            }





边框有蓝色但是白色仍然有我如何清除它? ?



the border have the blue color but the white color still there how i clear it ??

推荐答案

检查: ToolStrip,MenuStrip和StatusStrip控件的自定义渲染 [ ^ ]



希望它有所帮助!!



-

NG
Check this: Custom Rendering for the ToolStrip, MenuStrip, and StatusStrip controls[^]

Hope it helps!!

--
NG


这篇关于如何改变我在menustrip的边界的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆