コード例 #1
0
        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);
        }
コード例 #2
0
 public RibbonTabRenderEventArgs(Ribbon owner, Graphics g, Rectangle clip, RibbonTab tab)
     : base(owner, g, clip)
 {
     Tab = tab;
 }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
        internal override void SetOwnerTab(RibbonTab ownerTab)
        {
            base.SetOwnerTab(ownerTab);

            _dropDownItems.SetOwnerTab(OwnerTab);
        }
コード例 #5
0
ファイル: Ribbon.cs プロジェクト: okyereadugyamfi/softlogik
        /// <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;
        }
コード例 #6
0
ファイル: Ribbon.cs プロジェクト: okyereadugyamfi/softlogik
        /// <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));
            }
        }
コード例 #7
0
        internal override void SetOwnerTab(RibbonTab ownerTab)
        {
            base.SetOwnerTab(ownerTab);

            if (_dropDownItems != null) _dropDownItems.SetOwnerTab(ownerTab);
        }
コード例 #8
0
 /// <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;
 }
コード例 #9
0
        /// <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;
        }
コード例 #10
0
        /// <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;
        }