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; } }
private void DrawButton(Graphics g) { EnumControlState enumControlState = (!GetComboBoxButtonPressed()) ? EnumControlState.Default : EnumControlState.HeightLight; Rectangle rect = new Rectangle(ButtonRect.X - 2, ButtonRect.Y - 1, ButtonRect.Width + 1 + _Margin, ButtonRect.Height + 2); RoundRectangle roundRect = new RoundRectangle(rect, new CornerRadius(0, _CornerRadius, 0, _CornerRadius)); Blend blend = new Blend(3); blend.Positions = new float[3] { 0f, 0.5f, 1f }; blend.Factors = new float[3] { 0f, 1f, 0f }; GDIHelper.FillRectangle(g, roundRect, SkinManager.CurrentSkin.DefaultControlColor); Size arrowSize = new Size(12, 7); System.Windows.Forms.ArrowDirection direction = System.Windows.Forms.ArrowDirection.Down; GDIHelper.DrawArrow(g, direction, rect, arrowSize, 0f, Color.FromArgb(30, 178, 239)); Color borderColor = SkinManager.CurrentSkin.BorderColor; GDIHelper.DrawGradientLine(g, borderColor, 90, rect.X, rect.Y, rect.X, rect.Bottom - 1); }
private void DrawCaptionBackGround(Graphics g) { Rectangle rect = new Rectangle(0, 0, base.Width, CaptionHeight); Rectangle rect2 = new Rectangle(rect.Left, rect.Bottom, rect.Width, 1); g.SetClip(rect2, CombineMode.Exclude); GDIHelper.FillRectangle(g, rect, SkinManager.CurrentSkin.CaptionColor); g.ResetClip(); }
private void DrawButton(Graphics g) { EnumControlState enumControlState = (!GetComboBoxButtonPressed()) ? EnumControlState.Default : EnumControlState.HeightLight; Rectangle rect = new Rectangle(ButtonRect.X, ButtonRect.Y - 1, ButtonRect.Width + 1 + _Margin, ButtonRect.Height + 2); RoundRectangle roundRect = new RoundRectangle(rect, new CornerRadius(0)); GDIHelper.FillRectangle(g, roundRect, SkinManager.CurrentSkin.DefaultControlColor); GDIHelper.DrawArrow(arrowSize: new Size(12, 7), g: g, direction: System.Windows.Forms.ArrowDirection.Down, rect: rect, offset: 0f, c: Color.FromArgb(30, 178, 239)); Color borderColor = SkinManager.CurrentSkin.BorderColor; GDIHelper.DrawGradientLine(g, borderColor, 90, rect.X, rect.Y, rect.X, rect.Bottom - 1); }
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); } } }
private void DrawFormBackGround(Graphics g) { Rectangle rect = new Rectangle(0, 0, base.Width - 2, base.Height - 2); if (SkinManager.CurrentSkin.BackGroundImageEnable) { GDIHelper.DrawImage(g, rect, SkinManager.CurrentSkin.BackGroundImage, SkinManager.CurrentSkin.BackGroundImageOpacity); } else { GDIHelper.FillRectangle(g, rect, SkinManager.CurrentSkin.ThemeColor); } }
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); } }
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); }
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); } }
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; } } }
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); } }
public void DrawControlBox(Graphics g, Rectangle rect, EnumControlState controlState) { GradientColor color; switch (controlState) { case EnumControlState.HeightLight: color = SkinManager.CurrentSkin.ControlBoxHeightLightColor; break; case EnumControlState.Focused: color = SkinManager.CurrentSkin.ControlBoxPressedColor; break; default: color = SkinManager.CurrentSkin.ControlBoxDefaultColor; break; } Rectangle rect2 = new Rectangle(rect.Left, rect.Bottom, rect.Width, 1); g.SetClip(rect2, CombineMode.Exclude); GDIHelper.FillRectangle(g, rect, color); Color borderColor = SkinManager.CurrentSkin.BorderColor; Color color2 = Color.FromArgb(10, borderColor); using (LinearGradientBrush linearGradientBrush = new LinearGradientBrush(rect, borderColor, color2, 90f)) { linearGradientBrush.Blend.Positions = color.Positions; linearGradientBrush.Blend.Factors = color.Factors; using (Pen pen = new Pen(linearGradientBrush, 1f)) { g.DrawLine(pen, rect.X, rect.Y, rect.X, rect.Bottom); } } g.ResetClip(); }