示例#1
0
        protected override void OnRenderImageMargin(ToolStripRenderEventArgs e)
        {
            ToolStrip toolStrip = e.ToolStrip;
            Graphics  graphics  = e.Graphics;

            GDIHelper.InitializeGraphics(graphics);
            Rectangle affectedBounds = e.AffectedBounds;

            affectedBounds.Width--;
            affectedBounds.Height--;
            if (toolStrip is ToolStripDropDown)
            {
                affectedBounds.Width = _OffsetMargin;
                Color          menuImageMarginBackColor = MenuImageMarginBackColor;
                RoundRectangle roundRectangle           = new RoundRectangle(cornerRadius: new CornerRadius(MenuCornerRadius), rect: affectedBounds);
                GDIHelper.FillPath(graphics, new RoundRectangle(affectedBounds, new CornerRadius(MenuCornerRadius, 0, MenuCornerRadius, 0)), menuImageMarginBackColor, menuImageMarginBackColor);
                Image menuImageBackImage = MenuImageBackImage;
                if (menuImageBackImage != null && ShowMenuBackImage)
                {
                    ImageAttributes imageAttributes = new ImageAttributes();
                    GDIHelper.SetImageOpacity(imageAttributes, MenuImageBackImageOpacity);
                    graphics.DrawImage(Resources.logo_mini, new Rectangle(affectedBounds.X + 1, affectedBounds.Y + 2, menuImageBackImage.Width, menuImageBackImage.Height), 0, 0, menuImageBackImage.Width, menuImageBackImage.Height, GraphicsUnit.Pixel, imageAttributes);
                }
                Point pt  = new Point(affectedBounds.X + _OffsetMargin, affectedBounds.Y + 3);
                Point pt2 = new Point(affectedBounds.X + _OffsetMargin, affectedBounds.Bottom - 3);
                using (Pen pen = new Pen(SkinManager.CurrentSkin.BorderColor))
                {
                    graphics.DrawLine(pen, pt, pt2);
                }
            }
            else
            {
                base.OnRenderImageMargin(e);
            }
        }
示例#2
0
        protected override void OnDrawColumnHeader(DrawListViewColumnHeaderEventArgs e)
        {
            base.OnDrawColumnHeader(e);
            Graphics graphics = e.Graphics;

            GDIHelper.InitializeGraphics(graphics);
            Rectangle bounds = e.Bounds;

            GDIHelper.FillPath(graphics, new RoundRectangle(bounds, 0), _HeaderBeginColor, _HeaderEndColor);
            bounds.Height--;
            if (BorderStyle != 0)
            {
                using (Pen pen = new Pen(BorderColor))
                {
                    graphics.DrawLine(pen, new Point(bounds.Right, bounds.Bottom), new Point(bounds.Right, bounds.Top));
                    graphics.DrawLine(pen, new Point(bounds.Left, bounds.Bottom), new Point(bounds.Right, bounds.Bottom));
                }
            }
            else
            {
                GDIHelper.DrawPathBorder(graphics, new RoundRectangle(bounds, 0), _BorderColor);
            }
            bounds.Height++;
            TextFormatFlags formatFlags = GetFormatFlags(e.Header.TextAlign);
            Rectangle       rectangle   = new Rectangle(bounds.X + 3, bounds.Y, bounds.Width - 6, bounds.Height);
            Image           image       = null;
            Size            imageSize   = new Size(16, 16);
            Rectangle       empty       = Rectangle.Empty;

            if (e.Header.ImageList != null)
            {
                image = ((e.Header.ImageIndex == -1) ? null : e.Header.ImageList.Images[e.Header.ImageIndex]);
            }
            GDIHelper.DrawImageAndString(graphics, bounds, image, imageSize, e.Header.Text, _Font, e.ForeColor);
        }
示例#3
0
        private void DrawBackGround(Graphics g)
        {
            GDIHelper.InitializeGraphics(g);
            Rectangle      rect      = new Rectangle(1, 1, base.Width - 3, base.Height - 3);
            RoundRectangle roundRect = new RoundRectangle(rect, new CornerRadius(_CornerRadius));

            switch (_ControlState)
            {
            case EnumControlState.Default:
                if (base.FlatStyle != 0)
                {
                    GDIHelper.FillRectangle(g, roundRect, SkinManager.CurrentSkin.DefaultControlColor);
                    GDIHelper.DrawPathBorder(g, roundRect);
                }
                break;

            case EnumControlState.HeightLight:
                GDIHelper.FillRectangle(g, roundRect, SkinManager.CurrentSkin.HeightLightControlColor);
                GDIHelper.DrawPathBorder(g, roundRect);
                break;

            case EnumControlState.Focused:
                GDIHelper.FillRectangle(g, roundRect, SkinManager.CurrentSkin.FocusedControlColor);
                GDIHelper.DrawPathBorder(g, roundRect);
                GDIHelper.DrawPathInnerBorder(g, roundRect);
                break;
            }
        }
示例#4
0
 protected override void OnDrawSubItem(DrawListViewSubItemEventArgs e)
 {
     base.OnDrawSubItem(e);
     if (base.View == View.Details && e.ItemIndex != -1)
     {
         Rectangle          bounds    = e.Bounds;
         ListViewItemStates itemState = e.ItemState;
         Graphics           graphics  = e.Graphics;
         GDIHelper.InitializeGraphics(graphics);
         Blend blend = new Blend();
         blend.Positions = new float[4]
         {
             0f,
             0.4f,
             0.7f,
             1f
         };
         blend.Factors = new float[4]
         {
             0f,
             0.3f,
             0.8f,
             0.2f
         };
         if ((itemState & ListViewItemStates.Selected) == ListViewItemStates.Selected)
         {
             Color selectedBeginColor = _SelectedBeginColor;
             Color selectedEndColor   = _SelectedEndColor;
             selectedBeginColor = SkinManager.CurrentSkin.HeightLightControlColor.First;
             selectedEndColor   = SkinManager.CurrentSkin.HeightLightControlColor.Second;
             blend.Factors      = SkinManager.CurrentSkin.HeightLightControlColor.Factors;
             blend.Positions    = SkinManager.CurrentSkin.HeightLightControlColor.Positions;
             GDIHelper.FillPath(graphics, new RoundRectangle(bounds, 0), selectedBeginColor, selectedEndColor, blend);
         }
         else
         {
             if (e.ColumnIndex == 0)
             {
                 bounds.Inflate(0, -1);
             }
             Color selectedBeginColor = (e.ItemIndex % 2 == 0) ? _RowBackColor1 : _RowBackColor2;
             Color selectedEndColor   = selectedBeginColor;
             GDIHelper.FillPath(graphics, new RoundRectangle(bounds, 0), selectedBeginColor, selectedEndColor, blend);
         }
         if (e.ColumnIndex == 0)
         {
             OnDrawFirstSubItem(e, graphics);
         }
         else
         {
             DrawNormalSubItem(e, graphics);
         }
     }
 }
示例#5
0
        protected override void OnPaint(PaintEventArgs e)
        {
            e.Graphics.SmoothingMode     = SmoothingMode.AntiAlias;
            e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
            Graphics graphics = e.Graphics;

            GDIHelper.InitializeGraphics(graphics);
            DrawFormBackGround(graphics);
            DrawCaption(graphics);
            DrawFormBorder(graphics);
        }
示例#6
0
        protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
        {
            Size     arrowSize = new Size(8, 8);
            Graphics graphics  = e.Graphics;

            GDIHelper.InitializeGraphics(graphics);
            Rectangle arrowRectangle = e.ArrowRectangle;

            arrowRectangle.X -= 2;
            GDIHelper.DrawArrow(graphics, e.Direction, arrowRectangle, arrowSize);
        }
示例#7
0
        private void DrawComboBoxBorder(Graphics g)
        {
            GDIHelper.InitializeGraphics(g);
            Rectangle rect = new Rectangle(Point.Empty, base.Size);

            rect.Width--;
            rect.Height--;
            using (Pen pen = new Pen(SkinManager.CurrentSkin.BorderColor, 1f))
            {
                g.DrawRectangle(pen, rect);
            }
        }
示例#8
0
        protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
        {
            ToolStripItem item     = e.Item;
            Graphics      graphics = e.Graphics;

            GDIHelper.InitializeGraphics(graphics);
            if (item.Tag != null && item.Tag.Equals("Vicky"))
            {
                int       num  = (item.Width >= item.Height) ? item.Height : item.Width;
                Rectangle rect = new Rectangle(0, 0, num, num);
                rect.Inflate(-1, -1);
                Color empty      = Color.Empty;
                Color empty2     = Color.Empty;
                Color lightColor = Color.FromArgb(255, 220, 102);
                Blend blend      = new Blend();
                blend.Positions = new float[3]
                {
                    0f,
                    0.5f,
                    1f
                };
                blend.Factors = new float[3]
                {
                    0.25f,
                    0.75f,
                    1f
                };
                Color color = (item.Selected || item.Pressed) ? Color.FromArgb(24, 116, 205) : SkinManager.CurrentSkin.BorderColor;
                float width = 1f;
                graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
                if (item.Selected || item.Pressed)
                {
                    width  = 2f;
                    empty  = Color.FromArgb(255, 226, 48);
                    empty2 = Color.FromArgb(255, 220, 102);
                    GDIHelper.DrawCrystalButton(graphics, rect, empty, empty2, lightColor, blend);
                }
                using (Pen pen = new Pen(color, width))
                {
                    graphics.DrawEllipse(pen, rect);
                }
            }
            else
            {
                Rectangle      rect      = new Rectangle(1, 1, item.Width - 4, item.Height - 3);
                RoundRectangle roundRect = new RoundRectangle(rect, ItemCornerRadius);
                if (item.Selected || item.Pressed)
                {
                    GDIHelper.FillRectangle(graphics, roundRect, SkinManager.CurrentSkin.HeightLightControlColor);
                    GDIHelper.DrawPathBorder(graphics, roundRect);
                }
            }
        }
示例#9
0
        protected override void OnRenderOverflowButtonBackground(ToolStripItemRenderEventArgs e)
        {
            base.OnRenderOverflowButtonBackground(e);
            Graphics graphics = e.Graphics;

            GDIHelper.InitializeGraphics(graphics);
            ToolStripItem item   = e.Item;
            Rectangle     bounds = item.Bounds;

            bounds = new Rectangle(0, 0, bounds.Width, bounds.Height);
            Size arrowSize = new Size(8, 8);

            GDIHelper.DrawArrow(graphics, System.Windows.Forms.ArrowDirection.Down, bounds, arrowSize);
        }
示例#10
0
        protected override void OnRenderDropDownButtonBackground(ToolStripItemRenderEventArgs e)
        {
            ToolStripItem item     = e.Item;
            Graphics      graphics = e.Graphics;

            GDIHelper.InitializeGraphics(graphics);
            Rectangle      rect      = new Rectangle(0, 0, item.Width - 1, item.Height - 1);
            RoundRectangle roundRect = new RoundRectangle(rect, ItemCornerRadius);

            if (item.Selected || item.Pressed)
            {
                GDIHelper.FillRectangle(graphics, roundRect, SkinManager.CurrentSkin.HeightLightControlColor);
                GDIHelper.DrawPathBorder(graphics, roundRect);
            }
        }
示例#11
0
        private void DrawBorder(Graphics g)
        {
            GDIHelper.InitializeGraphics(g);
            Rectangle      rect      = new Rectangle(1, 1, base.Width - 3, base.Height - 3);
            RoundRectangle roundRect = new RoundRectangle(rect, _CornerRadius);
            Color          color     = (!_TextBox.Enabled || _TextBox.ReadOnly) ? Color.FromArgb(215, 250, 243) : Color.White;

            _TextBox.BackColor = color;
            GDIHelper.FillPath(g, roundRect, color, color);
            GDIHelper.DrawPathBorder(g, roundRect, _BorderColor);
            if (_ControlState == EnumControlState.HeightLight)
            {
                GDIHelper.DrawPathBorder(g, roundRect, SkinManager.CurrentSkin.HeightLightControlColor.Second);
                GDIHelper.DrawPathOuterBorder(g, roundRect, SkinManager.CurrentSkin.HeightLightControlColor.First);
            }
        }
示例#12
0
        protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
        {
            ToolStripItem item     = e.Item;
            Graphics      graphics = e.Graphics;

            GDIHelper.InitializeGraphics(graphics);
            Rectangle      rect           = new Rectangle(2, -1, item.Width - 4, item.Height + 1);
            RoundRectangle roundRectangle = new RoundRectangle(rect, new CornerRadius(0));

            if (item.Selected || item.Pressed)
            {
                Color baseColor = Color.FromArgb(200, SkinManager.CurrentSkin.HeightLightControlColor.First);
                Color color     = Color.FromArgb(250, baseColor);
                GDIHelper.FillRectangle(graphics, rect, SkinManager.CurrentSkin.HeightLightControlColor);
            }
        }
示例#13
0
        private void DrawComboBox(Graphics g)
        {
            GDIHelper.InitializeGraphics(g);
            Rectangle rect = new Rectangle(Point.Empty, base.Size);

            rect.Width--;
            rect.Height--;
            RoundRectangle roundRect = new RoundRectangle(rect, 0);
            Color          color     = base.Enabled ? _BackColor : SystemColors.Control;

            g.SetClip(EditRect, CombineMode.Exclude);
            GDIHelper.FillRectangle(g, roundRect, color);
            g.ResetClip();
            DrawButton(g);
            GDIHelper.DrawPathBorder(g, roundRect);
        }
示例#14
0
        private void DrawContent(Graphics g)
        {
            GDIHelper.InitializeGraphics(g);
            int       width     = base.Width;
            int       height    = base.Height;
            Rectangle rectangle = new Rectangle(_Margin, height / 2 - _BoxSize.Height / 2, _BoxSize.Width, _BoxSize.Height);
            Size      size      = g.MeasureString(Text, Font).ToSize();
            Rectangle rect      = default(Rectangle);

            rect.X      = rectangle.Right + _Margin;
            rect.Y      = _Margin;
            rect.Height = base.Height - _Margin * 2;
            rect.Width  = size.Width;
            RoundRectangle   roundRect    = new RoundRectangle(rectangle, _CornerRadius);
            EnumControlState controlState = _ControlState;

            if (controlState == EnumControlState.HeightLight)
            {
                GDIHelper.DrawPathBorder(g, roundRect, SkinManager.CurrentSkin.OuterBorderColor);
                GDIHelper.DrawPathInnerBorder(g, roundRect, SkinManager.CurrentSkin.HeightLightControlColor.First);
            }
            else
            {
                GDIHelper.DrawCheckBox(g, roundRect);
            }
            Color forceColor = base.Enabled ? ForeColor : SkinManager.CurrentSkin.UselessColor;

            GDIHelper.DrawImageAndString(g, rect, null, Size.Empty, Text, Font, forceColor);
            switch (base.CheckState)
            {
            case CheckState.Checked:
                GDIHelper.DrawCheckedStateByImage(g, rectangle);
                break;

            case CheckState.Indeterminate:
            {
                Rectangle rect2 = rectangle;
                rect2.Inflate(-3, -3);
                Color color = Color.FromArgb(46, 117, 35);
                GDIHelper.FillRectangle(g, new RoundRectangle(rect2, _CornerRadius), color);
                break;
            }
            }
        }
示例#15
0
        protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e)
        {
            ToolStrip toolStrip = e.ToolStrip;
            Graphics  graphics  = e.Graphics;

            GDIHelper.InitializeGraphics(graphics);
            Rectangle affectedBounds = e.AffectedBounds;

            if (toolStrip is ToolStripDropDown)
            {
                affectedBounds.Width--;
                affectedBounds.Height--;
                RoundRectangle roundRect = new RoundRectangle(cornerRadius: new CornerRadius(MenuCornerRadius), rect: affectedBounds);
                GDIHelper.DrawPathBorder(graphics, roundRect, MenuBorderColor);
            }
            else
            {
                base.OnRenderToolStripBorder(e);
            }
        }
示例#16
0
        protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
        {
            ToolStrip toolStrip = e.ToolStrip;
            Graphics  graphics  = e.Graphics;

            GDIHelper.InitializeGraphics(graphics);
            Rectangle imageRectangle = e.ImageRectangle;

            if (toolStrip is ToolStripDropDown)
            {
                imageRectangle.Width  -= 2;
                imageRectangle.Height -= 2;
                RoundRectangle roundRect = new RoundRectangle(imageRectangle, 1);
                GDIHelper.DrawCheckBox(graphics, roundRect);
                GDIHelper.DrawCheckedStateByImage(graphics, imageRectangle);
            }
            else
            {
                base.OnRenderItemCheck(e);
            }
        }
示例#17
0
文件: TXPanel.cs 项目: wwkkww1983/WMS
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            int      num      = (BorderWidth > 0) ? BorderWidth : 0;
            Graphics graphics = e.Graphics;

            GDIHelper.InitializeGraphics(graphics);
            GradientColor  color     = new GradientColor(_BackBeginColor, _BackEndColor, null, null);
            Rectangle      rect      = new Rectangle(0, 0, base.Size.Width - 1, base.Size.Height - 1);
            RoundRectangle roundRect = new RoundRectangle(rect, new CornerRadius(_CornerRadius));

            GDIHelper.FillRectangle(graphics, roundRect, color);
            if (_BorderWidth > 0)
            {
                rect.X      += _BorderWidth - 1;
                rect.Y      += _BorderWidth - 1;
                rect.Width  -= _BorderWidth - 1;
                rect.Height -= _BorderWidth - 1;
                GDIHelper.DrawPathBorder(graphics, new RoundRectangle(rect, new CornerRadius(_CornerRadius)), _BorderColor, BorderWidth);
            }
        }
示例#18
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            base.OnPaintBackground(e);
            Graphics graphics = e.Graphics;

            GDIHelper.InitializeGraphics(graphics);
            Rectangle textRect  = GetTextRect(graphics);
            Color     foreColor = base.Enabled ? _CaptionColor : SkinManager.CurrentSkin.UselessColor;

            switch (_BorderStyle)
            {
            case EnumBorderStyle.QQStyle:
                DrawQQStyleBorder(graphics, textRect);
                break;

            case EnumBorderStyle.Default:
                DrawDefaultBorder(graphics, textRect);
                break;
            }
            TextRenderer.DrawText(graphics, Text, _CaptionFont, textRect, foreColor, TextFormatFlags.Default);
        }
示例#19
0
            protected override void WndProc(ref Message m)
            {
                base.WndProc(ref m);
                int msg = m.Msg;

                if (msg == 15 || msg == 71)
                {
                    IntPtr dC = Win32.GetDC(m.HWnd);
                    try
                    {
                        using (Graphics graphics = Graphics.FromHdc(dC))
                        {
                            Rectangle rect = _owner.HeaderEndRect();
                            GDIHelper.InitializeGraphics(graphics);
                            GDIHelper.FillPath(graphics, new RoundRectangle(rect, 0), _owner._HeaderBeginColor, _owner._HeaderEndColor);
                            rect.Width--;
                            rect.Height--;
                            if (_owner.BorderStyle != 0)
                            {
                                using (Pen pen = new Pen(_owner.BorderColor))
                                {
                                    graphics.DrawLine(pen, new Point(rect.Left, rect.Bottom), new Point(rect.Left, rect.Top));
                                    graphics.DrawLine(pen, new Point(rect.Right, rect.Bottom), new Point(rect.Right, rect.Top));
                                    graphics.DrawLine(pen, new Point(rect.Left, rect.Bottom), new Point(rect.Right, rect.Bottom));
                                }
                            }
                            else
                            {
                                GDIHelper.DrawPathBorder(graphics, new RoundRectangle(rect, 0), _owner._BorderColor);
                            }
                        }
                    }
                    finally
                    {
                        Win32.ReleaseDC(m.HWnd, dC);
                    }
                }
            }
示例#20
0
        private void DrawContent(Graphics g)
        {
            GDIHelper.InitializeGraphics(g);
            int       width  = base.Width;
            int       height = base.Height;
            Rectangle rect   = new Rectangle(_Margin, height / 2 - _MaxRadius, _MaxRadius * 2, _MaxRadius * 2);
            Rectangle rect2  = new Rectangle(_Margin + _MaxRadius - _MinRadius, height / 2 - _MinRadius, _MinRadius * 2, _MinRadius * 2);
            Size      size   = g.MeasureString(Text, Font).ToSize();
            Rectangle bounds = default(Rectangle);

            bounds.X      = rect.Right + _Margin;
            bounds.Y      = height / 2 - size.Height / 2 + 1;
            bounds.Height = size.Height;
            bounds.Width  = base.Width - bounds.Left;
            GDIHelper.DrawEllipseBorder(g, rect, SkinManager.CurrentSkin.BorderColor, 2);
            GDIHelper.FillEllipse(g, rect2, SkinManager.CurrentSkin.DefaultControlColor.First);
            GDIHelper.DrawEllipseBorder(g, rect2, SkinManager.CurrentSkin.BorderColor, 1);
            switch (_ControlState)
            {
            case EnumControlState.HeightLight:
            case EnumControlState.Focused:
                rect.Inflate(1, 1);
                GDIHelper.DrawEllipseBorder(g, rect, SkinManager.CurrentSkin.OuterBorderColor, 1);
                rect.Inflate(-2, -2);
                GDIHelper.DrawEllipseBorder(g, rect, SkinManager.CurrentSkin.InnerBorderColor, 1);
                break;
            }
            Color foreColor = base.Enabled ? ForeColor : SkinManager.CurrentSkin.UselessColor;

            TextRenderer.DrawText(g, Text, Font, bounds, foreColor, TextFormatFlags.Default);
            if (base.Checked)
            {
                GDIHelper.FillEllipse(g, rect2, Color.FromArgb(15, 216, 32), Color.Green);
                foreColor = SkinManager.CurrentSkin.BorderColor;
                GDIHelper.DrawEllipseBorder(g, rect2, foreColor, 1);
            }
        }
示例#21
0
        protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
        {
            ToolStrip toolStrip = e.ToolStrip;
            Graphics  graphics  = e.Graphics;

            GDIHelper.InitializeGraphics(graphics);
            Rectangle      affectedBounds = e.AffectedBounds;
            RoundRectangle roundRect      = new RoundRectangle(cornerRadius: new CornerRadius(MenuCornerRadius), rect: affectedBounds);

            if (toolStrip is ToolStripDropDown || toolStrip is ContextMenuStrip)
            {
                CreateToolStripRegion(toolStrip, roundRect);
                GDIHelper.FillPath(graphics, roundRect, BackColor, BackColor);
            }
            else if (toolStrip is TXMenuStrip)
            {
                TXMenuStrip tXMenuStrip    = toolStrip as TXMenuStrip;
                Color       beginBackColor = tXMenuStrip.BeginBackColor;
                Color       endBackColor   = tXMenuStrip.EndBackColor;
                GDIHelper.FillPath(graphics, new RoundRectangle(affectedBounds, new CornerRadius(0)), beginBackColor, endBackColor);
            }
            else if (toolStrip is TXToolStrip)
            {
                affectedBounds.Inflate(1, 1);
                TXToolStrip tXToolStrip    = toolStrip as TXToolStrip;
                Color       beginBackColor = tXToolStrip.BeginBackColor;
                Color       endBackColor   = tXToolStrip.EndBackColor;
                GDIHelper.FillPath(graphics, new RoundRectangle(affectedBounds, new CornerRadius(0)), beginBackColor, endBackColor);
            }
            else if (toolStrip is TXStatusStrip)
            {
                TXStatusStrip tXStatusStrip  = toolStrip as TXStatusStrip;
                Color         beginBackColor = tXStatusStrip.BeginBackColor;
                Color         endBackColor   = tXStatusStrip.EndBackColor;
                GDIHelper.FillPath(graphics, new RoundRectangle(affectedBounds, new CornerRadius(0)), beginBackColor, endBackColor);
            }
        }
示例#22
0
        private void DrawTabPages(Graphics g)
        {
            Point pt    = PointToClient(Control.MousePosition);
            bool  flag  = false;
            bool  flag2 = base.Alignment == TabAlignment.Top || base.Alignment == TabAlignment.Bottom;
            LinearGradientMode linearGradientMode = flag2 ? LinearGradientMode.Vertical : LinearGradientMode.Horizontal;

            if (flag2)
            {
                IntPtr upDownButtonHandle = UpDownButtonHandle;
                if (upDownButtonHandle != IntPtr.Zero && Win32.IsWindowVisible(upDownButtonHandle))
                {
                    RECT lpRect = default(RECT);
                    Win32.GetWindowRect(upDownButtonHandle, ref lpRect);
                    Rectangle r = Rectangle.FromLTRB(lpRect.left, lpRect.top, lpRect.right, lpRect.bottom);
                    r = RectangleToClient(r);
                    switch (base.Alignment)
                    {
                    case TabAlignment.Top:
                        r.Y = 0;
                        break;

                    case TabAlignment.Bottom:
                        r.Y = base.ClientRectangle.Height - DisplayRectangle.Height;
                        break;
                    }
                    r.Height = base.ClientRectangle.Height;
                    g.SetClip(r, CombineMode.Exclude);
                    flag = true;
                }
            }
            for (int i = 0; i < base.TabCount; i++)
            {
                TabPage   tabPage     = base.TabPages[i];
                Rectangle tabRect     = GetTabRect(i);
                bool      flag3       = tabRect.Contains(pt);
                bool      flag4       = base.SelectedIndex == i;
                Color     color       = _BaseTabolor;
                Color     borderColor = _BorderColor;
                Blend     blend       = new Blend();
                blend.Positions = new float[5]
                {
                    0f,
                    0.3f,
                    0.5f,
                    0.7f,
                    1f
                };
                blend.Factors = new float[5]
                {
                    0.1f,
                    0.3f,
                    0.5f,
                    0.8f,
                    1f
                };
                if (flag4)
                {
                    color = _CheckedTabColor;
                }
                else if (flag3)
                {
                    color           = _HeightLightTabColor;
                    blend.Positions = new float[5]
                    {
                        0f,
                        0.3f,
                        0.6f,
                        0.8f,
                        1f
                    };
                    blend.Factors = new float[5]
                    {
                        0.2f,
                        0.4f,
                        0.6f,
                        0.5f,
                        0.4f
                    };
                }
                Rectangle rect = new Rectangle(tabRect.Left, tabRect.Bottom, tabRect.Width, 1);
                g.SetClip(rect, CombineMode.Exclude);
                CornerRadius cornerRadius = new CornerRadius(_TabCornerRadius, _TabCornerRadius, 0, 0);
                tabRect.X     += _TabMargin;
                tabRect.Width -= _TabMargin;
                tabRect.Y++;
                tabRect.Height--;
                RoundRectangle roundRect = new RoundRectangle(tabRect, cornerRadius);
                GDIHelper.InitializeGraphics(g);
                switch (_TabStyle)
                {
                case EnumTabStyle.AnglesWing:
                    cornerRadius   = new CornerRadius(_TabCornerRadius);
                    tabRect.X     += _TabCornerRadius;
                    tabRect.Width -= _TabCornerRadius * 2;
                    roundRect      = new RoundRectangle(tabRect, cornerRadius);
                    using (GraphicsPath path = roundRect.ToGraphicsAnglesWingPath())
                    {
                        using (LinearGradientBrush linearGradientBrush = new LinearGradientBrush(roundRect.Rect, color, _BackColor, LinearGradientMode.Vertical))
                        {
                            linearGradientBrush.Blend = blend;
                            g.FillPath(linearGradientBrush, path);
                        }
                    }
                    using (GraphicsPath path = roundRect.ToGraphicsAnglesWingPath())
                    {
                        using (Pen pen = new Pen(_BorderColor, 1f))
                        {
                            g.DrawPath(pen, path);
                        }
                    }
                    break;

                case EnumTabStyle.Default:
                    GDIHelper.FillPath(g, roundRect, color, _BackColor, blend);
                    GDIHelper.DrawPathBorder(g, roundRect, _BorderColor);
                    break;
                }
                g.ResetClip();
                if (base.Alignment == TabAlignment.Top)
                {
                    Image image     = null;
                    Size  imageSize = Size.Empty;
                    if (base.ImageList != null && tabPage.ImageIndex >= 0)
                    {
                        image     = base.ImageList.Images[tabPage.ImageIndex];
                        imageSize = image.Size;
                    }
                    GDIHelper.DrawImageAndString(g, tabRect, image, imageSize, tabPage.Text, _CaptionFont, _CaptionForceColor);
                }
                else
                {
                    bool hasImage = DrawTabImage(g, tabPage, tabRect);
                    DrawtabText(g, tabPage, tabRect, hasImage);
                }
            }
            if (flag)
            {
                g.ResetClip();
            }
            if (base.SelectedIndex > -1)
            {
                bool flag5 = true;
            }
        }
示例#23
0
        protected void DrawRibbonBtn(Graphics g)
        {
            Rectangle rect = new Rectangle(0, base.CaptionHeight, base.Width, base.Height - base.CaptionHeight + 1);

            g.SetClip(rect, CombineMode.Exclude);
            GDIHelper.InitializeGraphics(g);
            Rectangle ribbonBtnRect = RibbonBtnRect;

            ribbonBtnRect.Inflate(-1, -1);
            GDIHelper.FillEllipse(g, ribbonBtnRect, Color.White);
            Color empty      = Color.Empty;
            Color empty2     = Color.Empty;
            Color lightColor = Color.FromArgb(232, 246, 250);
            Blend blend      = new Blend();

            blend.Positions = new float[5]
            {
                0f,
                0.3f,
                0.5f,
                0.8f,
                1f
            };
            blend.Factors = new float[5]
            {
                0.15f,
                0.55f,
                0.7f,
                0.8f,
                0.95f
            };
            switch (_RibbonBtnState)
            {
            case EnumControlState.HeightLight:
                empty  = Color.FromArgb(225, 179, 27);
                empty2 = Color.FromArgb(255, 251, 232);
                break;

            case EnumControlState.Focused:
                empty  = Color.FromArgb(191, 113, 5);
                empty2 = Color.FromArgb(248, 227, 222);
                break;

            default:
                empty           = Color.FromArgb(239, 246, 249);
                empty2          = Color.FromArgb(224, 221, 231);
                blend.Positions = new float[5]
                {
                    0f,
                    0.3f,
                    0.5f,
                    0.85f,
                    1f
                };
                blend.Factors = new float[5]
                {
                    0.95f,
                    0.7f,
                    0.45f,
                    0.3f,
                    0.15f
                };
                break;
            }
            GDIHelper.DrawCrystalButton(g, ribbonBtnRect, empty, empty2, lightColor, blend);
            Color color = Color.FromArgb(65, 177, 199);

            GDIHelper.DrawEllipseBorder(g, ribbonBtnRect, color, 1);
            GDIHelper.DrawImage(imgSize: new Size(20, 20), g: g, rect: ribbonBtnRect, img: Resources.naruto);
            g.ResetClip();
        }
示例#24
0
 private void DrawButton(Graphics g)
 {
     GDIHelper.InitializeGraphics(g);
     RoundRectangle roundRectangle = new RoundRectangle(ButtonRect, 0);
     Color          color          = base.Enabled ? _BackColor : SystemColors.Control;
 }