public RibbonSensor(System.Windows.Forms.Control control, Ribbon ribbon, RibbonTab tabToSense) { _ribbon = ribbon; _control = control; _tab = tabToSense; _control.MouseMove += new System.Windows.Forms.MouseEventHandler(_control_MouseMove); _control.MouseDown += new System.Windows.Forms.MouseEventHandler(_control_MouseDown); _control.MouseUp += new System.Windows.Forms.MouseEventHandler(_control_MouseUp); _control.MouseLeave += new EventHandler(_control_MouseLeave); }
public RibbonTabRenderEventArgs(Ribbon owner, Graphics g, Rectangle clip, RibbonTab tab) : base(owner, g, clip) { Tab = tab; }
/// <summary> /// Sets the value of the OwnerTab property /// </summary> /// <param name="ownerTab">RibbonTab where this item is located</param> internal void SetOwnerTab(RibbonTab ownerTab) { _ownerTab = ownerTab; Items.SetOwnerTab(OwnerTab); }
internal override void SetOwnerTab(RibbonTab ownerTab) { base.SetOwnerTab(ownerTab); _dropDownItems.SetOwnerTab(OwnerTab); }
/// <summary> /// Sets the currently selected tab /// </summary> /// <param name="tab"></param> private void SetSelectedTab(RibbonTab tab) { if (tab == _lastSelectedTab) return; if (_lastSelectedTab != null) { _lastSelectedTab.SetSelected(false); RedrawTab(_lastSelectedTab); } if (tab != null) { tab.SetSelected(true); RedrawTab(tab); } _lastSelectedTab = tab; }
/// <summary> /// Redraws the specified tab /// </summary> /// <param name="tab"></param> private void RedrawTab(RibbonTab tab) { using (Graphics g = CreateGraphics()) { Rectangle clip = Rectangle.FromLTRB( tab.TabBounds.Left, tab.TabBounds.Top, tab.TabBounds.Right, tab.TabBounds.Bottom); g.SetClip(clip); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; tab.OnPaint(this, new RibbonElementPaintEventArgs(tab.TabBounds, g, RibbonElementSizeMode.None)); } }
internal override void SetOwnerTab(RibbonTab ownerTab) { base.SetOwnerTab(ownerTab); if (_dropDownItems != null) _dropDownItems.SetOwnerTab(ownerTab); }
/// <summary> /// Sets the value of the OwnerTab property /// </summary> /// <param name="ownerTab">RibbonTab where this item is located</param> internal virtual void SetOwnerTab(RibbonTab ownerTab) { _ownerTab = ownerTab; }
/// <summary> /// Creates the path of the tab and its contents /// </summary> /// <param name="tab"></param> /// <returns></returns> public GraphicsPath CreateTabPath(RibbonTab t) { GraphicsPath path = new GraphicsPath(); int corner = 6; int rightOffset = 1; path.AddLine( t.TabBounds.Left, t.TabBounds.Bottom, t.TabBounds.Left, t.TabBounds.Top + corner); path.AddArc( new Rectangle( t.TabBounds.Left, t.TabBounds.Top, corner, corner), 180, 90); path.AddLine( t.TabBounds.Left + corner, t.TabBounds.Top, t.TabBounds.Right - corner - rightOffset, t.TabBounds.Top); path.AddArc( new Rectangle( t.TabBounds.Right - corner - rightOffset, t.TabBounds.Top, corner, corner), -90, 90); path.AddLine( t.TabBounds.Right - rightOffset, t.TabBounds.Top + corner, t.TabBounds.Right - rightOffset, t.TabBounds.Bottom); return path; }
/// <summary> /// Creates the path of the tab and its contents /// </summary> /// <param name="tab"></param> /// <returns></returns> public GraphicsPath CreateCompleteTabPath(RibbonTab t) { GraphicsPath path = new GraphicsPath(); int corner = 6; path.AddLine(t.TabBounds.Left + corner, t.TabBounds.Top, t.TabBounds.Right - corner, t.TabBounds.Top); path.AddArc( Rectangle.FromLTRB(t.TabBounds.Right - corner, t.TabBounds.Top, t.TabBounds.Right, t.TabBounds.Top + corner), -90, 90); path.AddLine(t.TabBounds.Right, t.TabBounds.Top + corner, t.TabBounds.Right, t.TabBounds.Bottom - corner); path.AddArc(Rectangle.FromLTRB( t.TabBounds.Right, t.TabBounds.Bottom - corner, t.TabBounds.Right + corner, t.TabBounds.Bottom), -180, -90); path.AddLine(t.TabBounds.Right + corner, t.TabBounds.Bottom, t.TabContentBounds.Right - corner, t.TabBounds.Bottom); path.AddArc(Rectangle.FromLTRB( t.TabContentBounds.Right - corner, t.TabBounds.Bottom, t.TabContentBounds.Right, t.TabBounds.Bottom + corner), -90, 90); path.AddLine(t.TabContentBounds.Right, t.TabContentBounds.Top + corner, t.TabContentBounds.Right, t.TabContentBounds.Bottom - corner); path.AddArc(Rectangle.FromLTRB( t.TabContentBounds.Right - corner, t.TabContentBounds.Bottom - corner, t.TabContentBounds.Right, t.TabContentBounds.Bottom), 0, 90); path.AddLine(t.TabContentBounds.Right - corner, t.TabContentBounds.Bottom, t.TabContentBounds.Left + corner, t.TabContentBounds.Bottom); path.AddArc(Rectangle.FromLTRB( t.TabContentBounds.Left, t.TabContentBounds.Bottom - corner, t.TabContentBounds.Left + corner, t.TabContentBounds.Bottom), 90, 90); path.AddLine(t.TabContentBounds.Left, t.TabContentBounds.Bottom - corner, t.TabContentBounds.Left, t.TabBounds.Bottom + corner); path.AddArc(Rectangle.FromLTRB( t.TabContentBounds.Left, t.TabBounds.Bottom, t.TabContentBounds.Left + corner, t.TabBounds.Bottom + corner), 180, 90); path.AddLine(t.TabContentBounds.Left + corner, t.TabContentBounds.Top, t.TabBounds.Left - corner, t.TabBounds.Bottom); path.AddArc(Rectangle.FromLTRB( t.TabBounds.Left - corner, t.TabBounds.Bottom - corner, t.TabBounds.Left, t.TabBounds.Bottom), 90, -90); path.AddLine(t.TabBounds.Left, t.TabBounds.Bottom - corner, t.TabBounds.Left, t.TabBounds.Top + corner); path.AddArc(Rectangle.FromLTRB( t.TabBounds.Left, t.TabBounds.Top, t.TabBounds.Left + corner, t.TabBounds.Top + corner), 180, 90); path.CloseFigure(); return path; }