コード例 #1
0
        //post to header
        protected override void OnMouseLeave(EventArgs e)
        {
            base.OnMouseLeave(e);
            Point pt = this.PointToClient(Control.MousePosition);

            HeaderModule.MouseLeave(
                new MouseEventArgs(MouseButtons.None, 0, pt.X, pt.Y, 0));
        }
コード例 #2
0
 //post to header
 protected override void OnPaint(PaintEventArgs e)
 {
     if (_coll.Count < 1)
     {
         e.Graphics.Clear(SystemColors.AppWorkspace);
     }
     else
     {
         base.OnPaint(e);
         HeaderModule.Paint(e);
     }
 }
コード例 #3
0
 public TabControl()
 {
     this.SetStyle(ControlStyles.AllPaintingInWmPaint |
                   ControlStyles.DoubleBuffer |
                   ControlStyles.UserPaint |
                   ControlStyles.ResizeRedraw, true);
     this._coll = new TabPageCollection(this);
     if ((this._header = CreateHeaderModule()) == null)
     {
         throw new ArgumentNullException("CreateHeaderModule");
     }
 }
コード例 #4
0
 //post to header
 protected override void OnMouseUp(MouseEventArgs e)
 {
     base.OnMouseUp(e);
     HeaderModule.MouseUp(e);
 }
コード例 #5
0
 //make sure the header is correctly docked
 protected override void OnSizeChanged(EventArgs e)
 {
     base.OnSizeChanged(e);
     HeaderModule.SizeChanged();
 }
コード例 #6
0
 protected override void OnReload(HeaderModule.Section section, ITabPage start)
 {
     if ((section & HeaderModule.Section.Headers) != 0)
     {
         #region remeasure headers
         bool remeasure = start == null;
         //manage paths array
         while (_paths.Count > this.Owner.Pages.Count)
         {
             GraphicsPath path = (GraphicsPath)_paths[0];
             _paths.RemoveAt(0);
             path.Dispose();
         }
         while (_paths.Count < this.Owner.Pages.Count)
         {
             _paths.Add(new GraphicsPath());
         }
         //remeasure tabs
         int x = 1, width;
         using (Graphics gr = this.Owner.CreateGraphics())
         {
             for (int i = 0; i < this.Owner.Pages.Count; i++)
             {
                 ITabPage page = this.Owner.Pages[i];
                 GraphicsPath path = (GraphicsPath)_paths[i];
                 if (start == page) remeasure = true;
                 if (!remeasure)
                 {
                     x = (int)(path.GetBounds().Right) - 10;
                     continue;
                 }
                 #region measure header
                 if (page.Caption == null || page.Caption == "")
                     width = 24;
                 else
                     width = Math.Min(this.MaxHeaderWidth,
                         24 + (int)gr.MeasureString(page.Caption, _fontactive).Width);
                 path.Reset();
                 path.AddCurve(//create tab shape
                     new Point[]{new Point(x,19),
                                    new Point(x+12,7),
                                    new Point(x+19,3)}, 0.7f);
                 path.AddLine(x + 19, 3, x + width - 2, 3);
                 path.AddLine(x + width, 5, x + width, 19);
                 #endregion
                 x += width - 10;
             }
         }
         #endregion
     }
     if ((section & HeaderModule.Section.Browser) != 0)
     {
         #region tabs button
         //manage contextmenu
         while (_mnu.MenuItems.Count > this.Owner.Pages.Count)
         {
             MenuItem item = _mnu.MenuItems[0];
             _mnu.MenuItems.RemoveAt(0);
             item.Dispose();
         }
         while (_mnu.MenuItems.Count < this.Owner.Pages.Count)
         {
             _mnu.MenuItems.Add(new MenuItem("item",
                 new EventHandler(MenuItem_Click)));
         }
         //reset defaultitems
         foreach (MenuItem item in _mnu.MenuItems)
             item.DefaultItem = false;
         //update captions
         for (int i = 0; i < this.Owner.Pages.Count; i++)
         {
             ITabPage page = this.Owner.Pages[i];
             _mnu.MenuItems[i].Text = page.Caption;
             if (page == this.Owner.SelectedPage)
                 _mnu.MenuItems[i].DefaultItem = true;
         }
         _tabsstate = _mnu.MenuItems.Count > 0 ?
             ButtonState.Normal : ButtonState.Inactive;
         #endregion
     }
     if ((section & HeaderModule.Section.CloseButton) != 0)
     {
         #region close button
         ButtonState state = (
             this.Owner.SelectedPage != null &&
             this.Owner.SelectedPage.CanClose) ?
             ButtonState.Normal :
             ButtonState.Inactive;
         if (_closestate != state)
         {
             _closestate = state;
             Refresh(Section.CloseButton);
         }
         #endregion
     }
 }
コード例 #7
0
 protected override void OnRefresh(HeaderModule.Section section)
 {
     using (Region rgn = new Region())
     {
         if ((section & HeaderModule.Section.Headers) != 0)
             rgn.Union(new Rectangle(0, 0, _tabsbtn.X, HeaderHeight));
         if ((section & HeaderModule.Section.Browser) != 0)
             rgn.Union(_tabsbtn);
         if ((section & HeaderModule.Section.CloseButton) != 0)
             rgn.Union(_closebtn);
         //update control
         this.Owner.Invalidate(rgn, false);
         this.Owner.Update();
     }
 }
コード例 #8
0
ファイル: TabControl.cs プロジェクト: kjburns31/vixen-modules
 public TabControl()
 {
     this.SetStyle(ControlStyles.AllPaintingInWmPaint |
         ControlStyles.DoubleBuffer |
         ControlStyles.UserPaint |
         ControlStyles.ResizeRedraw, true);
     this._coll = new TabPageCollection(this);
     if ((this._header = CreateHeaderModule()) == null)
         throw new ArgumentNullException("CreateHeaderModule");
 }