protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { Graphics G = e.Graphics; G.Clear(Color.FromArgb(40, 40, 40)); G.SmoothingMode = SmoothingMode.AntiAlias; HuraModule hura = new HuraModule(); GP1 = hura.CreateRound(0, 0, Width - 1, Height - 1, 7); GP2 = hura.CreateRound(1, 1, Width - 3, Height - 3, 7); R1 = new Rectangle(0, 2, Width - 1, Height - 1); GB1 = new LinearGradientBrush(R1, Color.FromArgb(45, 45, 45), Color.FromArgb(50, 50, 50), 90f); G.SetClip(GP1); G.FillRectangle(GB1, R1); I1 = Convert.ToInt32((_Value - _Minimum) / (_Maximum - _Minimum) * (Width - 3)); if (I1 > 1) { GP3 = hura.CreateRound(1, 1, I1, Height - 3, 7); R2 = new Rectangle(1, 1, I1, Height - 3); GB2 = new LinearGradientBrush(R2, Color.FromArgb(70, 70, 70), Color.FromArgb(70, 70, 70), 90f); G.FillPath(GB2, GP3); G.DrawPath(P1, GP3); G.SetClip(GP3); G.SmoothingMode = SmoothingMode.None; G.FillRectangle(B1, R2.X, R2.Y + 1, R2.Width, R2.Height / 2); G.SmoothingMode = SmoothingMode.AntiAlias; G.ResetClip(); } G.DrawPath(P2, GP1); G.DrawPath(P1, GP2); }
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { Graphics G = e.Graphics; G.Clear(Color.FromArgb(40, 40, 40)); G.SmoothingMode = SmoothingMode.AntiAlias; HuraModule hura = new HuraModule(); GP1 = hura.CreateRound(0, 2, Height - 5, Height - 5, 5); GP2 = hura.CreateRound(1, 3, Height - 7, Height - 7, 5); PB1 = new PathGradientBrush(GP1); PB1.CenterColor = Color.FromArgb(50, 50, 50); PB1.SurroundColors = new Color[] { Color.FromArgb(45, 45, 45) }; PB1.FocusScales = new PointF(0.3f, 0.3f); G.FillPath(PB1, GP1); G.DrawPath(P11, GP1); G.DrawPath(P22, GP2); if (_Checked) { G.DrawLine(P3, 5, Height - 9, 8, Height - 7); G.DrawLine(P3, 7, Height - 7, Height - 8, 7); G.DrawLine(P4, 4, Height - 10, 7, Height - 8); G.DrawLine(P4, 6, Height - 8, Height - 9, 6); } SZ1 = G.MeasureString(Text, Font); PT1 = new PointF(Height - 3, Height / 2 - SZ1.Height / 2); G.DrawString(Text, Font, Brushes.Black, PT1.X + 1, PT1.Y + 1); G.DrawString(Text, Font, Brushes.White, PT1); }