public override void PaintHook() { this.BackColor = Color.White; G.Clear(Parent.BackColor); Pen p = new Pen(Color.FromArgb(204, 204, 204), 1); Pen o = new Pen(Color.FromArgb(252, 252, 252), 7); G.FillPath(Brushes.White, Draw.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2)); G.DrawPath(o, Draw.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2)); G.DrawPath(p, Draw.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2)); Font drawFont = new Font("Tahoma", 9, FontStyle.Regular); var _with4 = txtbox; _with4.Size = new Size(Width - 10, Height - 14); _with4.ForeColor = Color.FromArgb(72, 72, 72); _with4.Font = drawFont; _with4.TextAlign = TextAlignment; _with4.UseSystemPasswordChar = UseSystemPasswordChar; DrawCorners(Parent.BackColor, ClientRectangle); }
public override void PaintHook() { this.Font = new Font("Arial", 10); G.Clear(this.BackColor); G.SmoothingMode = SmoothingMode.HighQuality; switch (MouseState) { case State.MouseNone: Pen p = new Pen(Color.FromArgb(120, 159, 22), 1); LinearGradientBrush x = new LinearGradientBrush(ClientRectangle, Color.FromArgb(157, 209, 57), Color.FromArgb(130, 181, 18), LinearGradientMode.Vertical); G.FillPath(x, Draw.RoundRect(ClientRectangle, 4)); G.DrawPath(p, Draw.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 3)); G.DrawLine(new Pen(Color.FromArgb(190, 232, 109)), 2, 1, Width - 3, 1); DrawText(HorizontalAlignment.Center, Color.FromArgb(240, 240, 240), 0); break; case State.MouseDown: Pen p1 = new Pen(Color.FromArgb(120, 159, 22), 1); LinearGradientBrush x1 = new LinearGradientBrush(ClientRectangle, Color.FromArgb(125, 171, 25), Color.FromArgb(142, 192, 40), LinearGradientMode.Vertical); G.FillPath(x1, Draw.RoundRect(ClientRectangle, 4)); G.DrawPath(p1, Draw.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 3)); G.DrawLine(new Pen(Color.FromArgb(142, 172, 30)), 2, 1, Width - 3, 1); DrawText(HorizontalAlignment.Center, Color.FromArgb(250, 250, 250), 1); break; case State.MouseOver: Pen p2 = new Pen(Color.FromArgb(120, 159, 22), 1); LinearGradientBrush x2 = new LinearGradientBrush(ClientRectangle, Color.FromArgb(165, 220, 59), Color.FromArgb(137, 191, 18), LinearGradientMode.Vertical); G.FillPath(x2, Draw.RoundRect(ClientRectangle, 4)); G.DrawPath(p2, Draw.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 3)); G.DrawLine(new Pen(Color.FromArgb(190, 232, 109)), 2, 1, Width - 3, 1); DrawText(HorizontalAlignment.Center, Color.FromArgb(240, 240, 240), -1); break; } this.Cursor = Cursors.Hand; }
public override void PaintHook() { this.Font = new Font("Arial", 10); G.Clear(this.BackColor); G.SmoothingMode = SmoothingMode.HighQuality; switch (MouseState) { case State.MouseNone: Pen p = new Pen(Color.FromArgb(34, 112, 171), 1); LinearGradientBrush x = new LinearGradientBrush(ClientRectangle, Color.FromArgb(51, 159, 231), Color.FromArgb(33, 128, 206), LinearGradientMode.Vertical); G.FillPath(x, Draw.RoundRect(ClientRectangle, 4)); G.DrawPath(p, Draw.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 3)); G.DrawLine(new Pen(Color.FromArgb(131, 197, 241)), 2, 1, Width - 3, 1); DrawText(HorizontalAlignment.Center, Color.FromArgb(240, 240, 240), 0); break; case State.MouseDown: Pen p1 = new Pen(Color.FromArgb(34, 112, 171), 1); LinearGradientBrush x1 = new LinearGradientBrush(ClientRectangle, Color.FromArgb(37, 124, 196), Color.FromArgb(53, 153, 219), LinearGradientMode.Vertical); G.FillPath(x1, Draw.RoundRect(ClientRectangle, 4)); G.DrawPath(p1, Draw.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 3)); DrawText(HorizontalAlignment.Center, Color.FromArgb(250, 250, 250), 1); break; case State.MouseOver: Pen p2 = new Pen(Color.FromArgb(34, 112, 171), 1); LinearGradientBrush x2 = new LinearGradientBrush(ClientRectangle, Color.FromArgb(54, 167, 243), Color.FromArgb(35, 165, 217), LinearGradientMode.Vertical); G.FillPath(x2, Draw.RoundRect(ClientRectangle, 4)); G.DrawPath(p2, Draw.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 3)); G.DrawLine(new Pen(Color.FromArgb(131, 197, 241)), 2, 1, Width - 3, 1); DrawText(HorizontalAlignment.Center, Color.FromArgb(240, 240, 240), -1); break; } this.Cursor = Cursors.Hand; }
protected override void OnPaint(PaintEventArgs e) { this.Font = new Font("Tahoma", 9, FontStyle.Regular); SolidBrush bs = new SolidBrush(this.ForeColor); if (!(DropDownStyle == ComboBoxStyle.DropDownList)) { DropDownStyle = ComboBoxStyle.DropDownList; } Bitmap B = new Bitmap(Width, Height); Graphics G = Graphics.FromImage(B); Font m = new Font("Marlett", 11); G.Clear(Color.FromArgb(50, 50, 50)); LinearGradientBrush GradientBrush = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), Color.FromArgb(234, 234, 234), Color.FromArgb(242, 242, 242), 270f); G.FillRectangle(GradientBrush, new Rectangle(0, 0, Width, Height)); Pen op = new Pen(Color.FromArgb(204, 204, 204), 1); Pen o = new Pen(Color.FromArgb(237, 237, 237), 6); G.DrawPath(o, Draw.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2)); G.DrawPath(op, Draw.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2)); if (X >= Width - 20 & Over) { GradientBrush = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), Color.FromArgb(239, 239, 239), Color.FromArgb(236, 236, 236), 90f); G.FillRectangle(GradientBrush, new Rectangle(Width - 22, 2, 20, Height - 4)); } else if (X < Width - 20 & Over) { GradientBrush = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), Color.FromArgb(239, 239, 239), Color.FromArgb(236, 236, 236), 90f); G.FillRectangle(GradientBrush, new Rectangle(2, 2, Width - 27, Height - 4)); } int S1 = (int)G.MeasureString(" ... ", Font).Height; if (SelectedIndex != -1) { G.DrawString(Items[SelectedIndex].ToString(), Font, bs, 4, (Height / 2 - S1 / 2)); G.DrawString("6", m, bs, Width - 22, (Height / 2 - S1 / 2)); } else { if ((Items != null) & Items.Count > 0) { G.DrawString(Items[0].ToString(), Font, bs, 4, (Height / 2 - S1 / 2)); G.DrawString("6", m, bs, Width - 22, (Height / 2 - S1 / 2)); } else { G.DrawString(" ... ", Font, bs, 4, (Height / 2 - S1 / 2)); G.DrawString("6", m, bs, Width - 22, (Height / 2 - S1 / 2)); } } G.DrawLine(new Pen(Color.FromArgb(120, 255, 255, 255)), 1, 1, Width - 3, 1); e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0); G.Dispose(); B.Dispose(); }
public override void PaintHook() { G.SmoothingMode = SmoothingMode.HighQuality; G.Clear(Color.Transparent); int s = 0; Pen pe = new Pen(Color.FromArgb(34, 112, 171), 1); LinearGradientBrush xe = new LinearGradientBrush(ClientRectangle, Color.FromArgb(31, 119, 181), Color.FromArgb(33, 128, 206), LinearGradientMode.Vertical); G.FillPath(xe, Draw.RoundRect(ClientRectangle, 4)); G.DrawPath(pe, Draw.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 3)); G.DrawLine(new Pen(Color.FromArgb(65, 131, 197, 241)), 2, 1, Width - 3, 1); //Fill if (_Value > 1) { if (Vertical) { s = (Height - Convert.ToInt32(_Value / _Maximum * Height)); if (Glossy) { Pen p = new Pen(Color.FromArgb(34, 112, 171), 1); LinearGradientBrush x = new LinearGradientBrush(ClientRectangle, Color.FromArgb(51, 159, 231), Color.FromArgb(33, 128, 206), LinearGradientMode.Vertical); G.FillPath(x, Draw.RoundRect(new Rectangle(2, s + 3, Width - 5, Convert.ToInt32(_Value / _Maximum * Height) - 6), 4)); DrawGradient(Color.FromArgb(50, Color.White), Color.Transparent, 4, s + 3, 10, Convert.ToInt32(_Value / _Maximum * Height) - 7, 270); G.DrawPath(p, Draw.RoundRect(new Rectangle(2, s + 3, Width - 5, Convert.ToInt32(_Value / _Maximum * Height) - 6), 3)); G.DrawLine(new Pen(Color.FromArgb(90, 131, 197, 241)), 4, s + 4, Width - 6, s + 4); } else if (!Glossy) { Pen p = new Pen(Color.FromArgb(34, 112, 171), 1); LinearGradientBrush x = new LinearGradientBrush(ClientRectangle, Color.FromArgb(51, 159, 231), Color.FromArgb(33, 128, 206), LinearGradientMode.Vertical); G.FillPath(x, Draw.RoundRect(new Rectangle(2, s + 3, Width - 5, Convert.ToInt32(_Value / _Maximum * Height) - 6), 4)); G.DrawPath(p, Draw.RoundRect(new Rectangle(2, s + 3, Width - 5, Convert.ToInt32(_Value / _Maximum * Height) - 6), 3)); G.DrawLine(new Pen(Color.FromArgb(90, 131, 197, 241)), 4, s + 4, Width - 6, s + 4); } } else if (!Vertical) { s = (Height - Convert.ToInt32(_Value / _Maximum * Width)); if (Glossy) { Pen p = new Pen(Color.FromArgb(34, 112, 171), 1); LinearGradientBrush x = new LinearGradientBrush(ClientRectangle, Color.FromArgb(51, 159, 231), Color.FromArgb(33, 128, 206), LinearGradientMode.Vertical); G.FillPath(x, Draw.RoundRect(new Rectangle(2, 2, Convert.ToInt32(_Value / _Maximum * Width) - 6, Height - 5), 4)); G.DrawLine(new Pen(Color.FromArgb(90, 131, 197, 241)), 4, 3, Convert.ToInt32(_Value / _Maximum * Width) - 7, 3); DrawGradient(Color.FromArgb(60, Color.White), Color.Transparent, 3, 3, Convert.ToInt32(_Value / _Maximum * Width) - 7, Height / 2 - 3, 0); G.DrawPath(p, Draw.RoundRect(new Rectangle(2, 2, Convert.ToInt32(_Value / _Maximum * Width) - 6, Height - 5), 3)); } else if (!Glossy) { Pen p = new Pen(Color.FromArgb(34, 112, 171), 1); LinearGradientBrush x = new LinearGradientBrush(ClientRectangle, Color.FromArgb(51, 159, 231), Color.FromArgb(33, 128, 206), LinearGradientMode.Vertical); G.FillPath(x, Draw.RoundRect(new Rectangle(2, 2, Convert.ToInt32(_Value / _Maximum * Width) - 6, Height - 5), 4)); G.DrawLine(new Pen(Color.FromArgb(90, 131, 197, 241)), 4, 3, Convert.ToInt32(_Value / _Maximum * Width) - 7, 3); G.DrawPath(p, Draw.RoundRect(new Rectangle(2, 2, Convert.ToInt32(_Value / _Maximum * Width) - 6, Height - 5), 3)); } } } //Borders }