public NTabControl()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();


            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
            NMenuItem mnuSwitch = new NMenuItem("About");

            mnuSwitch.OwnerDraw = true;
            mnuSwitch.Click    += new EventHandler(mnuSwitch_Click);
            this.contextMenu.MenuItems.Add(mnuSwitch);

            AllowDrop       = true;
            this.Appearance = TabAppearance.Normal;



            //init the brushes for painting
            SetBrush();
        }
        /// <summary>
        /// Builds the context menu
        /// </summary>
        private void BuildMenu()
        {
            NMenuItem mnuMaximize = new NMenuItem("Maximize");

            mnuMaximize.Click += new EventHandler(mnuMaximize_Click);
            mnuMaximize.ItemColors.ForeColor          = Color.Black;
            mnuMaximize.ItemColors.GradientStartColor = this.lightColor;
            mnuMaximize.ItemColors.GradientEndColor   = this.darkColor;
            //mnuMaximize.image = GetImage();
            popMenu.MenuItems.Add(mnuMaximize);
            mnuMaximize.OwnerDraw = true;

            NMenuItem mnuMinimize = new NMenuItem("Minimize");

            mnuMinimize.Click += new EventHandler(mnuMinimize_Click);
            mnuMinimize.ItemColors.ForeColor          = Color.Black;
            mnuMinimize.ItemColors.GradientStartColor = this.lightColor;
            mnuMinimize.ItemColors.GradientEndColor   = this.darkColor;
            popMenu.MenuItems.Add(mnuMinimize);
            mnuMinimize.OwnerDraw = true;

            NMenuItem mnuDash = new NMenuItem("-");

            popMenu.MenuItems.Add(mnuDash);
            mnuDash.OwnerDraw = true;

            NMenuItem mnuExit = new NMenuItem("Exit");

            mnuExit.Click += new EventHandler(mnuExit_Click);

            mnuExit.ItemColors.ForeColor          = Color.Black;
            mnuExit.ItemColors.GradientStartColor = this.lightColor;
            mnuExit.ItemColors.GradientEndColor   = this.darkColor;


            popMenu.MenuItems.Add(mnuExit);
            mnuExit.OwnerDraw = true;
        }
示例#3
0
 public MenuItemColors(NMenuItem parent) : base()
 {
     owner = parent;
 }