protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); //#Zone " Declarations " List <Color> Colors1 = new List <Color>(); List <Color> Colors2 = new List <Color>(); C1 = Color.FromArgb(62, 62, 62); C2 = Color.FromArgb(1, 1, 1); G = e.Graphics; LGB1 = new LinearGradientBrush(new Point(0, 0), new Point(Width, 0), Color.Transparent, Color.Transparent); LGB2 = new LinearGradientBrush(new Point(0, 1), new Point(Width, 1), Color.Transparent, Color.Transparent); conObj.AddObjectRange(new LinearGradientBrush[] { LGB1, LGB2 }); CB1 = new ColorBlend(); CB2 = new ColorBlend(); //#End Zone //#Zone " Colors first line " for (int i = 0; i <= 255; i += 51) { Colors1.Add(Color.FromArgb(i, C1)); } for (int i = 255; i >= 0; i += -51) { Colors1.Add(Color.FromArgb(i, C1)); } //#End Zone //#Zone " Colors Second line " for (int i = 0; i <= 255; i += 51) { Colors2.Add(Color.FromArgb(i, C2)); } for (int i = 255; i >= 0; i += -51) { Colors2.Add(Color.FromArgb(i, C2)); } //#End Zone //#Zone " colorblend first line " CB1.Colors = Colors1.ToArray(); CB1.Positions = new float[] { 0.0f, 0.08f, 0.16f, 0.24f, 0.32f, 0.4f, 0.48f, 0.56f, 0.64f, 0.72f, 0.8f, 1.0f }; //#End Zone //#Zone " colorblend second line " CB2.Colors = Colors2.ToArray(); CB2.Positions = new float[] { 0.0f, 0.08f, 0.16f, 0.24f, 0.32f, 0.4f, 0.48f, 0.56f, 0.64f, 0.72f, 0.8f, 1.0f }; //#End Zone //#Zone " Pen " LGB1.InterpolationColors = CB1; LGB2.InterpolationColors = CB2; P1 = new Pen(LGB1); P2 = new Pen(LGB2); conObj.AddObjectRange(new Pen[] { P1, P2 }); //#End Zone G.DrawLine(P1, 0, 0, Width, 0); G.DrawLine(P2, 0, 1, Width, 1); conObj.Dispose(); }
private void Init(PaintEventArgs e) { G = e.Graphics; cn = new ContainerObjectDisposable(); R1 = new Rectangle(1, 1, Width - 2, Height - 2); R2 = new Rectangle(2, 2, Width - 4, Height - 4); GP1 = Helper.RoundRect(R1, 11); cn.AddObject(GP1); GP2 = Helper.RoundRect(R2, 11); cn.AddObject(GP2); B1 = new SolidBrush(Color.FromArgb(40, 40, 40)); cn.AddObject(B1); if (Checked) { B2 = new SolidBrush(Color.FromArgb(84, 135, 171)); PGB1 = new PathGradientBrush(GP2) { CenterColor = Color.FromArgb(84, 135, 171), SurroundColors = new Color[] { Color.FromArgb(113, 176, 200) }, FocusScales = new PointF(0.85f, 0.65f) }; } else { B2 = new SolidBrush(Color.FromArgb(29, 29, 29)); PGB1 = new PathGradientBrush(GP2) { CenterColor = Color.FromArgb(29, 29, 29), SurroundColors = new Color[] { Color.FromArgb(39, 39, 39) }, FocusScales = new PointF(0.85f, 0.65f) }; } cn.AddObjectRange(new Brush[] { B2, PGB1 }); B3 = new SolidBrush(Color.FromArgb(107, 107, 107)); cn.AddObject(B3); CheckSize = new Size(22, R2.Height); R3 = new Rectangle(Width - 2 - 22, 2, CheckSize.Width, CheckSize.Height); GP3 = Helper.RoundRect(R3, 11); R4 = new Rectangle(R3.X + 1, R3.Y + 1, R3.Width - 2, R3.Height - 2); GP4 = Helper.RoundRect(R4, 11); R5 = new Rectangle(0, 2, CheckSize.Width, CheckSize.Height); GP5 = Helper.RoundRect(R5, 11); R6 = new Rectangle(R5.X + 1, R5.Y + 1, R5.Width - 2, R5.Height - 2); GP6 = Helper.RoundRect(R6, 11); cn.AddObjectRange(new GraphicsPath[] { GP3, GP4, GP5, GP6 }); if (Hover) { LGB1 = new LinearGradientBrush(R3, Color.FromArgb(86, 86, 86), Color.FromArgb(42, 42, 42), LinearGradientMode.Vertical); LGB2 = new LinearGradientBrush(new Rectangle(R4.X - 1, R4.Y - 1, R4.Width + 2, R4.Height + 2), Color.FromArgb(147, 147, 147), Color.FromArgb(68, 68, 68), LinearGradientMode.Vertical); P1 = new Pen(LGB2); LGB3 = new LinearGradientBrush(R5, Color.FromArgb(86, 86, 86), Color.FromArgb(42, 42, 42), LinearGradientMode.Vertical); LGB4 = new LinearGradientBrush(new Rectangle(R6.X - 1, R6.Y - 1, R6.Width + 2, R6.Height + 2), Color.FromArgb(147, 147, 147), Color.FromArgb(68, 68, 68), LinearGradientMode.Vertical); P2 = new Pen(LGB4); } else { LGB1 = new LinearGradientBrush(R3, Color.FromArgb(59, 59, 59), Color.FromArgb(29, 29, 29), LinearGradientMode.Vertical); LGB2 = new LinearGradientBrush(new Rectangle(R4.X - 1, R4.Y - 1, R4.Width + 2, R4.Height + 2), Color.FromArgb(101, 101, 101), Color.FromArgb(42, 42, 42), LinearGradientMode.Vertical); P1 = new Pen(LGB2); LGB3 = new LinearGradientBrush(R5, Color.FromArgb(59, 59, 59), Color.FromArgb(29, 29, 29), LinearGradientMode.Vertical); LGB4 = new LinearGradientBrush(new Rectangle(R6.X - 1, R6.Y - 1, R6.Width + 2, R6.Height + 2), Color.FromArgb(101, 101, 101), Color.FromArgb(42, 42, 42), LinearGradientMode.Vertical); P2 = new Pen(LGB4); } cn.AddObjectRange(new Brush[] { LGB1, LGB2, LGB3, LGB4, //P1, //P2 }); cn.AddObjectRange(new Pen[] { P1, P2 }); }
private void Init(PaintEventArgs e) { G = e.Graphics; controlSize = new Size(86, btnSize.Height); //#Zone " Rectangle " R1 = new Rectangle(Padding, Padding, Width - Padding * 2, Height - Padding * 2); R2 = new Rectangle(R1.X + 1, R1.Y + 1, R1.Width - 2, R1.Height - 2); R4 = new Rectangle(Padding, Padding, Width, 20); R5 = new Rectangle(Right - Padding - (controlSize.Width + 20), Padding, controlSize.Width, controlSize.Height); R6 = new Rectangle(R5.X + 1, R5.Y + 1, R5.Width - 2, R5.Height - 2); //#End Zone //#Zone " Graphic path " GP1 = Helper.RoundRect(R1, 18); GP2 = Helper.RoundRect(R2, 18); //GP3 = ControlRect(R5, 9); //GP4 = ControlRect(R6, 9); GP3 = Helper.RoundRect(R5, 9); GP4 = Helper.RoundRect(R6, 9); controlboxPath = new GraphicsPath(); containerDisposable.AddObjectRange(new GraphicsPath[] { GP1, GP2, GP3, GP4, controlboxPath }); //#End Zone //#Zone " Brush " B1 = new SolidBrush(Color.FromArgb(32, 32, 32)); containerDisposable.AddObject(B1); //#End Zone //#Zone " Color " C1 = Color.FromArgb(81, 81, 81); C2 = Color.FromArgb(43, 43, 43); C3 = Color.FromArgb(21, 21, 21); C4 = Color.FromArgb(10, 10, 10); C5 = Color.FromArgb(167, 167, 167); C6 = Color.FromArgb(83, 83, 83); C7 = Color.FromArgb(41, 41, 41); C8 = Color.FromArgb(33, 33, 33); C9 = Color.FromArgb(41, 41, 41); C10 = Color.FromArgb(77, 77, 77); //#End Zone //#Zone " Linear Gradient Brush " LGB1 = new LinearGradientBrush(R4, C1, C2, LinearGradientMode.Vertical); LGB2 = new LinearGradientBrush(R5, C6, C7, LinearGradientMode.Vertical); LGB3 = new LinearGradientBrush(R5, C8, C7, LinearGradientMode.Vertical); LGB4 = new LinearGradientBrush(new Point(R5.Left + 27, R5.Top + 2), new Point(R5.Left + 27, R5.Bottom - 2), C3, C4); LGB5 = new LinearGradientBrush(new Point(R5.Left + 28, R5.Top + 2), new Point(R5.Left + 28, R5.Bottom - 1), C5, C6); LGB6 = new LinearGradientBrush(R5, C9, C10, LinearGradientMode.Vertical); containerDisposable.AddObjectRange(new LinearGradientBrush[] { LGB1, LGB2, LGB3, LGB4, LGB5, LGB6 }); //#End Zone //#Zone " Pen " P1 = new Pen(Color.FromArgb(33, 33, 33)); P2 = new Pen(Color.FromArgb(240, 240, 240)); P3 = new Pen(LGB3); P4 = new Pen(new SolidBrush(Color.FromArgb(83, 83, 83))); P5 = new Pen(LGB4); P6 = new Pen(LGB5); containerDisposable.AddObjectRange(new Pen[] { P1, P2, P3, P4, P5, P6 }); //#End Zone }