public void RenderSpeckleTagBlankIcon(Graphics graphics) { int zoomFadeLow = GH_Canvas.ZoomFadeLow; Rectangle stage = Stage; --stage.Width; --stage.Height; stage.Inflate(-1, -1); var roundedRectangle1 = GH_CapsuleRenderEngine.CreateRoundedRectangle(stage, 2); stage.Inflate(-1, -1); var roundedRectangle2 = GH_CapsuleRenderEngine.CreateRoundedRectangle(stage, 1); var linearGradientBrush1 = new LinearGradientBrush(stage, Color.FromArgb(zoomFadeLow, 240, 240, 240), Color.FromArgb(zoomFadeLow, 185, 185, 185), LinearGradientMode.Vertical); var linearGradientBrush2 = new LinearGradientBrush(stage, Color.FromArgb(0, Color.White), Color.FromArgb(Convert.ToInt32((double)zoomFadeLow * 0.8), Color.White), LinearGradientMode.Vertical); linearGradientBrush1.WrapMode = WrapMode.TileFlipXY; linearGradientBrush2.WrapMode = WrapMode.TileFlipXY; Pen pen1 = new Pen(Color.FromArgb(zoomFadeLow, 10, 107, 252)); Pen pen2 = new Pen(linearGradientBrush2); graphics.FillPath(linearGradientBrush1, roundedRectangle1); // if (drawCallBack != null) // drawCallBack(graphics, (double) zoomFadeLow); graphics.DrawPath(pen1, roundedRectangle1); graphics.DrawPath(pen2, roundedRectangle2); pen1.Dispose(); pen2.Dispose(); linearGradientBrush1.Dispose(); linearGradientBrush2.Dispose(); roundedRectangle1.Dispose(); roundedRectangle2.Dispose(); }
public override void OnDraw(Graphics g) { Pen FillPen; if (this.IsPress) { FillPen = new Pen(Setting.BUTTONPRESSCOLOR); } else { FillPen = new Pen(Setting.BUTTONUNPRESSCOLOR); } if (this.Owner.Locked) { FillPen = new Pen(Setting.COMPONENTLOCKTEXTCOLOR); } Pen TextPen = new Pen(Setting.TEXTCOLOR); Pen BorderPen = new Pen(Setting.BORDERCOLOR); StringFormat Format = new StringFormat(); Format.Alignment = StringAlignment.Center; Format.LineAlignment = StringAlignment.Center; GraphicsPath ButtonPath = GH_CapsuleRenderEngine.CreateRoundedRectangle(Bounds, 2); g.FillPath(FillPen.Brush, ButtonPath); g.DrawPath(BorderPen, ButtonPath); g.DrawString(Text, GH_FontServer.Standard, TextPen.Brush, Bounds, Format); Format.Dispose(); }