Beispiel #1
0
 private void DrawLedEllipse3D(PaintArgs p, Rectangle r, IndicatorStyleLED3D style3D, bool active, Color color)
 {
     r.Inflate(-1, -1);
     r.Width--;
     r.Height--;
     if (style3D == IndicatorStyleLED3D.None)
     {
         this.DrawLedEllipse(p, r, color);
     }
     else
     {
         GraphicsPath graphicsPath = new GraphicsPath();
         graphicsPath.AddEllipse(r);
         PathGradientBrush pathGradientBrush = new PathGradientBrush(graphicsPath);
         if (p.Rotation == RotationQuad.X000)
         {
             pathGradientBrush.CenterPoint = new PointF((float)(r.Left + r.Width / 3), (float)(r.Top + r.Height / 3));
         }
         else if (p.Rotation == RotationQuad.X090)
         {
             pathGradientBrush.CenterPoint = new PointF((float)(r.Left + r.Width / 3), (float)(r.Bottom - r.Height / 3));
         }
         else if (p.Rotation == RotationQuad.X180)
         {
             pathGradientBrush.CenterPoint = new PointF((float)(r.Right - r.Width / 3), (float)(r.Bottom - r.Height / 3));
         }
         else
         {
             pathGradientBrush.CenterPoint = new PointF((float)(r.Right - r.Width / 3), (float)(r.Top + r.Height / 3));
         }
         if (active)
         {
             pathGradientBrush.CenterColor = Color.White;
         }
         else
         {
             pathGradientBrush.CenterColor = Color.Silver;
         }
         pathGradientBrush.SurroundColors = new Color[1]
         {
             color
         };
         p.Graphics.FillPath(pathGradientBrush, graphicsPath);
         pathGradientBrush.Dispose();
         graphicsPath.Dispose();
         p.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
         p.Graphics.DrawEllipse(p.Graphics.Pen(color, 2f), r);
         p.Graphics.SmoothingMode = SmoothingMode.None;
     }
 }
Beispiel #2
0
        private void DrawLedDiamond3D(PaintArgs p, Rectangle r, IndicatorStyleLED3D style3D, bool active, Color color)
        {
            this.DrawLedDiamond(p, r, color);
            switch (style3D)
            {
            case IndicatorStyleLED3D.Auto:
                BorderSpecial.DrawDiamond(p, r, BevelStyle.Raised, p.Width / 10, this.Bezel.Color);
                break;

            case IndicatorStyleLED3D.Thin:
                BorderSpecial.DrawDiamond(p, r, BevelStyle.Raised, 2, this.Bezel.Color);
                break;
            }
        }