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); }
public PaintScrollBarArrowEventArgs(System.Drawing.Graphics graphics, Rectangle arrowRect, ControlState controlState, System.Windows.Forms.ArrowDirection arrowDirection, System.Windows.Forms.Orientation orientation, bool enabled) { this._graphics = graphics; this._arrowRect = arrowRect; this._controlState = controlState; this._arrowDirection = arrowDirection; this._orientation = orientation; this._enabled = enabled; }
public ScrollBarRenderArrowEventArgs(System.Drawing.Graphics graphics, Rectangle arrowRect, ControlState controlState, System.Windows.Forms.ArrowDirection arrowDirection, System.Windows.Forms.Orientation orientation, bool enabled) { this.graphics_0 = graphics; this.rectangle_0 = arrowRect; this.controlState_0 = controlState; this.arrowDirection_0 = arrowDirection; this.orientation_0 = orientation; this.bool_0 = enabled; }
public PaintScrollBarArrowEventArgs(System.Drawing.Graphics graphics, Rectangle arrowRect, ControlState controlState, System.Windows.Forms.ArrowDirection arrowDirection, System.Windows.Forms.Orientation orientation, bool enabled) { this._graphics = graphics; this._arrowRect = arrowRect; this._controlState = controlState; this._arrowDirection = arrowDirection; this._orientation = orientation; this._enabled = enabled; }
public static void DrawArrow(Graphics g, System.Windows.Forms.ArrowDirection direction, Rectangle rect, Size arrowSize, float offset, Color c) { Point point = new Point(rect.X + rect.Width / 2, rect.Y + rect.Height / 2); using (GraphicsPath graphicsPath = new GraphicsPath()) { PointF[] points = null; switch (direction) { case System.Windows.Forms.ArrowDirection.Down: points = new PointF[4] { new PointF((float)point.X, (float)(point.Y + arrowSize.Height / 2)), new PointF((float)(point.X - arrowSize.Width / 2), (float)(point.Y - arrowSize.Height / 2)), new PointF((float)point.X, (float)(point.Y - arrowSize.Height / 2) + offset), new PointF((float)(point.X + arrowSize.Width / 2), (float)(point.Y - arrowSize.Height / 2)) }; break; case System.Windows.Forms.ArrowDirection.Up: points = new PointF[4] { new PointF((float)point.X, (float)(point.Y - arrowSize.Height / 2)), new PointF((float)(point.X - arrowSize.Width / 2), (float)(point.Y + arrowSize.Height / 2)), new PointF((float)point.X, (float)(point.Y + arrowSize.Height / 2) - offset), new Point(point.X + arrowSize.Width / 2, point.Y + arrowSize.Height / 2) }; break; case System.Windows.Forms.ArrowDirection.Left: points = new PointF[4] { new PointF((float)(point.X - arrowSize.Width / 2), (float)point.Y), new PointF((float)(point.X + arrowSize.Width / 2), (float)(point.Y - arrowSize.Height / 2)), new PointF((float)(point.X + arrowSize.Width / 2) - offset, (float)point.Y), new PointF((float)(point.X + arrowSize.Width / 2), (float)(point.Y + arrowSize.Height / 2)) }; break; case System.Windows.Forms.ArrowDirection.Right: points = new PointF[4] { new PointF((float)(point.X + arrowSize.Width / 2), (float)point.Y), new PointF((float)(point.X - arrowSize.Width / 2), (float)(point.Y - arrowSize.Height / 2)), new PointF((float)(point.X - arrowSize.Width / 2) + offset, (float)point.Y), new PointF((float)(point.X - arrowSize.Width / 2), (float)(point.Y + arrowSize.Height / 2)) }; break; } graphicsPath.AddLines(points); using (Brush brush = new SolidBrush(c)) { g.FillPath(brush, graphicsPath); } } }
public static bool IsValidArrowDirection(System.Windows.Forms.ArrowDirection direction) { switch (direction) { case System.Windows.Forms.ArrowDirection.Left: case System.Windows.Forms.ArrowDirection.Up: case System.Windows.Forms.ArrowDirection.Right: case System.Windows.Forms.ArrowDirection.Down: return(true); default: return(false); } }
/// <summary> /// Initializes a new instance of the <see cref="ZeroitMetroNavigationButton" /> class. /// </summary> public ZeroitMetroNavigationButton() { this._Style = Design.Style.Light; this._ArrowDirection = System.Windows.Forms.ArrowDirection.Left; this._ArrowPath = null; this._CircleRect = new RectangleF(); this._BorderColor = Design.MetroColors.LightBorder; this._BorderHoverColor = Design.MetroColors.AccentBlue; this._BorderPressedColor = Design.MetroColors.AccentBlue; this._DefaultColor = Design.MetroColors.LightDefault; this._HoverColor = Design.MetroColors.LightHover; this._PressedColor = Design.MetroColors.AccentBlue; this._ArrowColor = Design.MetroColors.LightBorder; this._ArrowHoverColor = Design.MetroColors.AccentBlue; this._ArrowPressedColor = Design.MetroColors.LightDefault; this._DisabledColor = Design.MetroColors.LightDisabled; this._DisabledArrowColor = Design.MetroColors.DisabledBorder; this._MouseState = Helpers.MouseState.None; this._AutoStyle = true; this.Font = new System.Drawing.Font("Segoe UI", 9f); this.SetStyle(ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); this.UpdateStyles(); this.BackColor = Color.Transparent; this.Size = new System.Drawing.Size(24, 24); this._CircleRect = new RectangleF(2.5f, 2.5f, 18f, 18f); this._ArrowPath = new GraphicsPath(FillMode.Alternate); PointF pointF = new PointF(7.5f, 11.5f); GraphicsPath graphicsPath = this._ArrowPath; PointF pointF1 = new PointF(11.5f, 15.5f); graphicsPath.AddLine(pointF1, pointF); GraphicsPath graphicsPath1 = this._ArrowPath; pointF1 = new PointF(11.5f, 7.5f); graphicsPath1.AddLine(pointF, pointF1); this._ArrowPath.StartFigure(); GraphicsPath graphicsPath2 = this._ArrowPath; pointF1 = new PointF(16.5f, 11.5f); graphicsPath2.AddLine(pointF, pointF1); }
public ScrollBarRenderArrowEventArgs(System.Drawing.Graphics graphics, Rectangle arrowRect, ControlState controlState, System.Windows.Forms.ArrowDirection arrowDirection, System.Windows.Forms.Orientation orientation) : this(graphics, arrowRect, controlState, arrowDirection, orientation, true) { }
public static void DrawArrow(Graphics g, System.Windows.Forms.ArrowDirection direction, Rectangle rect, Size arrowSize) { float offset = 1.8f; DrawArrow(g, direction, rect, arrowSize, offset, Color.FromArgb(55, 63, 78)); }
/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Control.Paint" /> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs" /> that contains the event data.</param> protected override void OnPaint(PaintEventArgs e) { Graphics graphics = e.Graphics; graphics.SmoothingMode = SmoothingMode.AntiAlias; graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; int num = Math.Min(this.Width, this.Height); float single = (float)num / 24f; graphics.Transform = new Matrix(single, 0f, 0f, single, (float)(checked (this.Width - num)) / 2f, (float)(checked (this.Height - num)) / 2f); using (Pen pen = new Pen(this._BorderColor, 1.5f)) { using (SolidBrush solidBrush = new SolidBrush(this._DefaultColor)) { Color color = this._ArrowColor; switch (this._MouseState) { case Helpers.MouseState.None: { pen.Color = this._BorderColor; solidBrush.Color = this._DefaultColor; color = this._ArrowColor; break; } case Helpers.MouseState.Over: { pen.Color = this._BorderHoverColor; solidBrush.Color = this._HoverColor; color = this._ArrowHoverColor; break; } case Helpers.MouseState.Pressed: { pen.Color = this._BorderPressedColor; solidBrush.Color = this._PressedColor; color = this._ArrowPressedColor; break; } } if (!this.Enabled) { pen.Color = this._DisabledArrowColor; solidBrush.Color = this._DisabledColor; color = this._DisabledArrowColor; } graphics.FillEllipse(solidBrush, this._CircleRect); graphics.DrawEllipse(pen, this._CircleRect); System.Windows.Forms.ArrowDirection arrowDirection = this._ArrowDirection; if (arrowDirection == System.Windows.Forms.ArrowDirection.Right) { graphics.MultiplyTransform(new Matrix(-1f, 0f, 0f, 1f, 23f, 0f)); } else if (arrowDirection == System.Windows.Forms.ArrowDirection.Up) { graphics.MultiplyTransform(new Matrix(0f, 1f, -1f, 0f, 23f, 0f)); } else if (arrowDirection == System.Windows.Forms.ArrowDirection.Down) { graphics.RotateTransform(-90f); graphics.TranslateTransform(-23f, 0f); } pen.Width = 2f; pen.Color = color; graphics.DrawPath(pen, this._ArrowPath); } } base.OnPaint(e); }