protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { Bitmap B = new Bitmap(Width, Height); Graphics G = Graphics.FromImage(B); Rectangle ClientRectangle = new Rectangle(0, 0, Width - 1, Height - 1); Height = txtbox.Height + 11; Font drawFont = new Font("Tahoma", 9, FontStyle.Regular); var _with2 = txtbox; _with2.Width = Width - 12; _with2.ForeColor = Color.FromArgb(102, 102, 102); _with2.Font = drawFont; _with2.TextAlign = TextAlignment; _with2.UseSystemPasswordChar = UseSystemPasswordChar; G.Clear(BackColor); G.SmoothingMode = SmoothingMode.HighQuality; G.CompositingQuality = CompositingQuality.HighQuality; G.FillRectangle(new SolidBrush(Color.White), ClientRectangle); G.DrawPath(new Pen(Color.FromArgb(255, 207, 188)), Draw.RoundRect(new Rectangle(1, 1, Width - 3, Height - 3), 1)); G.DrawPath(new Pen(Color.FromArgb(255, 207, 188)), Draw.RoundRect(new Rectangle(1, 1, Width - 3, Height - 3), 2)); G.DrawPath(new Pen(Color.FromArgb(205, 87, 40)), Draw.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 2)); G.DrawPath(new Pen(Color.FromArgb(205, 87, 40)), Draw.RoundRect(new Rectangle(0, 0, Width - 1, Height - 1), 3)); e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0); G.Dispose(); B.Dispose(); }
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { Bitmap B = new Bitmap(Width, Height); Graphics G = Graphics.FromImage(B); Rectangle ClientRectangle = new Rectangle(0, 0, Width - 1, Height - 1); base.OnPaint(e); G.SmoothingMode = SmoothingMode.HighQuality; G.Clear(BackColor); Font drawFont = new Font("Tahoma", 11, FontStyle.Regular); Pen p = new Pen(Color.FromArgb(157, 118, 103), 1); Brush nb = new SolidBrush(Color.FromArgb(86, 109, 109)); switch (State) { case MouseState.None: LinearGradientBrush lgb = new LinearGradientBrush(ClientRectangle, Color.FromArgb(249, 163, 128), Color.FromArgb(237, 139, 99), 90); G.FillPath(lgb, Draw.RoundRect(ClientRectangle, 3)); G.DrawPath(p, Draw.RoundRect(ClientRectangle, 3)); G.DrawString(Text, drawFont, nb, new Rectangle(0, 0, Width - 1, Height - 1), new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); break; case MouseState.Over: LinearGradientBrush lgb1 = new LinearGradientBrush(ClientRectangle, Color.FromArgb(255, 186, 153), Color.FromArgb(255, 171, 135), 90); G.FillPath(lgb1, Draw.RoundRect(ClientRectangle, 3)); G.DrawPath(p, Draw.RoundRect(ClientRectangle, 3)); G.DrawString(Text, drawFont, nb, new Rectangle(0, 0, Width - 1, Height - 1), new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); break; case MouseState.Down: LinearGradientBrush lgb2 = new LinearGradientBrush(ClientRectangle, Color.FromArgb(200, 116, 83), Color.FromArgb(194, 101, 65), 90); G.FillPath(lgb2, Draw.RoundRect(ClientRectangle, 3)); G.DrawPath(p, Draw.RoundRect(ClientRectangle, 3)); G.DrawString(Text, drawFont, nb, new Rectangle(0, 0, Width - 1, Height - 1), new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); break; } e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0); G.Dispose(); B.Dispose(); }
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { Bitmap B = new Bitmap(Width, Height); Graphics G = Graphics.FromImage(B); Rectangle TopBar = new Rectangle(0, 0, Width - 1, 30); Rectangle FixBottom = new Rectangle(0, 26, Width - 1, 0); Rectangle Body = new Rectangle(0, 5, Width - 1, Height - 6); base.OnPaint(e); G.Clear(Color.Fuchsia); G.SmoothingMode = SmoothingMode.HighSpeed; LinearGradientBrush lbb = new LinearGradientBrush(Body, Color.FromArgb(242, 241, 240), Color.FromArgb(240, 240, 238), 90); G.FillPath(lbb, Draw.RoundRect(Body, 1)); G.DrawPath(new Pen(new SolidBrush(Color.FromArgb(60, 60, 60))), Draw.RoundRect(Body, 1)); LinearGradientBrush lgb = new LinearGradientBrush(TopBar, Color.FromArgb(87, 86, 81), Color.FromArgb(60, 59, 55), 90); //Dim tophatch As New HatchBrush(HatchStyle.DarkUpwardDiagonal, Color.FromArgb(20, 20, 20), Color.Transparent) G.FillPath(lgb, Draw.RoundRect(TopBar, 4)); //G.FillPath(tophatch, Draw.RoundRect(TopBar, 4)) G.DrawPath(Pens.Black, Draw.RoundRect(TopBar, 3)); G.DrawPath(Pens.Black, Draw.RoundRect(FixBottom, 1)); G.FillRectangle(Brushes.White, 1, 27, Width - 2, Height - 29); Font drawFont = new Font("Tahoma", 10, FontStyle.Regular); G.DrawString(Text, drawFont, new SolidBrush(Color.WhiteSmoke), new Rectangle(25, 0, Width - 1, 27), new StringFormat { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center }); G.DrawIcon(Parent.FindForm().Icon, new Rectangle(5, 5, 16, 16)); e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0); G.Dispose(); B.Dispose(); }
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { Bitmap B = new Bitmap(Width, Height); Graphics G = Graphics.FromImage(B); Rectangle TopBar = new Rectangle(0, 0, Width - 1, 20); Rectangle box = new Rectangle(0, 0, Width - 1, Height - 10); base.OnPaint(e); G.Clear(Color.Transparent); G.SmoothingMode = SmoothingMode.HighQuality; LinearGradientBrush bodygrade = new LinearGradientBrush(ClientRectangle, Color.White, Color.White, 120); G.FillPath(bodygrade, Draw.RoundRect(new Rectangle(0, 12, Width - 1, Height - 15), 1)); LinearGradientBrush outerBorder = new LinearGradientBrush(ClientRectangle, Color.FromArgb(50, 50, 50), Color.DimGray, 90); G.DrawPath(new Pen(outerBorder), Draw.RoundRect(new Rectangle(0, 12, Width - 1, Height - 15), 1)); LinearGradientBrush lbb = new LinearGradientBrush(TopBar, Color.FromArgb(87, 86, 81), Color.FromArgb(60, 59, 55), 90); G.FillPath(lbb, Draw.RoundRect(TopBar, 1)); G.DrawPath(new Pen(new SolidBrush(Color.FromArgb(50, 50, 50))), Draw.RoundRect(TopBar, 2)); Font drawFont = new Font("Tahoma", 9, FontStyle.Regular); G.DrawString(Text, drawFont, new SolidBrush(Color.White), TopBar, new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0); G.Dispose(); B.Dispose(); }
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { Bitmap B = new Bitmap(Width, Height); Graphics G = Graphics.FromImage(B); base.OnPaint(e); G.SmoothingMode = SmoothingMode.HighQuality; G.Clear(BackColor); LinearGradientBrush bg0 = new LinearGradientBrush(bgr, Color.FromArgb(60, 59, 55), Color.FromArgb(60, 59, 55), 90); G.FillPath(bg0, Draw.RoundRect(bgr, 10)); LinearGradientBrush lgb10 = new LinearGradientBrush(MinBtn, Color.FromArgb(152, 151, 146), Color.FromArgb(56, 55, 51), 90); G.FillEllipse(lgb10, MinBtn); G.DrawEllipse(Pens.DimGray, MinBtn); G.DrawString("0", Font, new SolidBrush(Color.FromArgb(58, 57, 53)), new Rectangle((int)5.5, 6, 0, 0)); LinearGradientBrush lgb20 = new LinearGradientBrush(MaxBtn, Color.FromArgb(152, 151, 146), Color.FromArgb(56, 55, 51), 90); G.FillEllipse(lgb20, MaxBtn); G.DrawEllipse(Pens.DimGray, MaxBtn); G.DrawString("1", Font, new SolidBrush(Color.FromArgb(58, 57, 53)), new Rectangle(26, 7, 0, 0)); LinearGradientBrush lgb30 = new LinearGradientBrush(CloseBtn, Color.FromArgb(247, 150, 116), Color.FromArgb(223, 81, 6), 90); G.FillEllipse(lgb30, CloseBtn); G.DrawEllipse(Pens.DimGray, CloseBtn); G.DrawString("r", Font, new SolidBrush(Color.FromArgb(58, 57, 53)), new Rectangle(46, 7, 0, 0)); switch (State) { case MouseState.None: LinearGradientBrush bg = new LinearGradientBrush(bgr, Color.FromArgb(60, 59, 55), Color.FromArgb(60, 59, 55), 90); G.FillPath(bg, Draw.RoundRect(bgr, 10)); LinearGradientBrush lgb1 = new LinearGradientBrush(MinBtn, Color.FromArgb(152, 151, 146), Color.FromArgb(56, 55, 51), 90); G.FillEllipse(lgb1, MinBtn); G.DrawEllipse(Pens.DimGray, MinBtn); G.DrawString("0", Font, new SolidBrush(Color.FromArgb(58, 57, 53)), new Rectangle((int)5.5, 6, 0, 0)); LinearGradientBrush lgb2 = new LinearGradientBrush(MaxBtn, Color.FromArgb(152, 151, 146), Color.FromArgb(56, 55, 51), 90); G.FillEllipse(lgb2, MaxBtn); G.DrawEllipse(Pens.DimGray, MaxBtn); G.DrawString("1", Font, new SolidBrush(Color.FromArgb(58, 57, 53)), new Rectangle(26, 7, 0, 0)); LinearGradientBrush lgb3 = new LinearGradientBrush(CloseBtn, Color.FromArgb(247, 150, 116), Color.FromArgb(223, 81, 6), 90); G.FillEllipse(lgb3, CloseBtn); G.DrawEllipse(Pens.DimGray, CloseBtn); G.DrawString("r", Font, new SolidBrush(Color.FromArgb(58, 57, 53)), new Rectangle(46, 7, 0, 0)); break; case MouseState.Over: if (X > 3 && X < 20) { LinearGradientBrush bg1 = new LinearGradientBrush(bgr, Color.FromArgb(60, 59, 55), Color.FromArgb(60, 59, 55), 90); G.FillPath(bg1, Draw.RoundRect(bgr, 10)); LinearGradientBrush lgb11 = new LinearGradientBrush(MinBtn, Color.FromArgb(172, 171, 166), Color.FromArgb(76, 75, 71), 90); G.FillEllipse(lgb11, MinBtn); G.DrawEllipse(Pens.DimGray, MinBtn); G.DrawString("0", Font, new SolidBrush(Color.FromArgb(58, 57, 53)), new Rectangle((int)5.5, 6, 0, 0)); LinearGradientBrush lgb21 = new LinearGradientBrush(MaxBtn, Color.FromArgb(152, 151, 146), Color.FromArgb(56, 55, 51), 90); G.FillEllipse(lgb21, MaxBtn); G.DrawEllipse(Pens.DimGray, MaxBtn); G.DrawString("1", Font, new SolidBrush(Color.FromArgb(58, 57, 53)), new Rectangle(26, 7, 0, 0)); LinearGradientBrush lgb31 = new LinearGradientBrush(CloseBtn, Color.FromArgb(247, 150, 116), Color.FromArgb(223, 81, 6), 90); G.FillEllipse(lgb31, CloseBtn); G.DrawEllipse(Pens.DimGray, CloseBtn); G.DrawString("r", Font, new SolidBrush(Color.FromArgb(58, 57, 53)), new Rectangle(46, 7, 0, 0)); } else if (X > 23 && X < 40) { LinearGradientBrush bg3 = new LinearGradientBrush(bgr, Color.FromArgb(60, 59, 55), Color.FromArgb(60, 59, 55), 90); G.FillPath(bg3, Draw.RoundRect(bgr, 10)); LinearGradientBrush lgb13 = new LinearGradientBrush(MinBtn, Color.FromArgb(152, 151, 146), Color.FromArgb(56, 55, 51), 90); G.FillEllipse(lgb13, MinBtn); G.DrawEllipse(Pens.DimGray, MinBtn); G.DrawString("0", Font, new SolidBrush(Color.FromArgb(58, 57, 53)), new Rectangle((int)5.5, 6, 0, 0)); LinearGradientBrush lgb23 = new LinearGradientBrush(MaxBtn, Color.FromArgb(172, 171, 166), Color.FromArgb(76, 75, 71), 90); G.FillEllipse(lgb23, MaxBtn); G.DrawEllipse(Pens.DimGray, MaxBtn); G.DrawString("1", Font, new SolidBrush(Color.FromArgb(58, 57, 53)), new Rectangle(26, 7, 0, 0)); LinearGradientBrush lgb33 = new LinearGradientBrush(CloseBtn, Color.FromArgb(247, 150, 116), Color.FromArgb(223, 81, 6), 90); G.FillEllipse(lgb33, CloseBtn); G.DrawEllipse(Pens.DimGray, CloseBtn); G.DrawString("r", Font, new SolidBrush(Color.FromArgb(58, 57, 53)), new Rectangle(46, 7, 0, 0)); } else if (X > 43 && X < 60) { LinearGradientBrush bg3 = new LinearGradientBrush(bgr, Color.FromArgb(60, 59, 55), Color.FromArgb(60, 59, 55), 90); G.FillPath(bg3, Draw.RoundRect(bgr, 10)); LinearGradientBrush lgb13 = new LinearGradientBrush(MinBtn, Color.FromArgb(152, 151, 146), Color.FromArgb(56, 55, 51), 90); G.FillEllipse(lgb13, MinBtn); G.DrawEllipse(Pens.DimGray, MinBtn); G.DrawString("0", Font, new SolidBrush(Color.FromArgb(58, 57, 53)), new Rectangle((int)5.5, 6, 0, 0)); LinearGradientBrush lgb23 = new LinearGradientBrush(MaxBtn, Color.FromArgb(152, 151, 146), Color.FromArgb(56, 55, 51), 90); G.FillEllipse(lgb23, MaxBtn); G.DrawEllipse(Pens.DimGray, MaxBtn); G.DrawString("1", Font, new SolidBrush(Color.FromArgb(58, 57, 53)), new Rectangle(26, 7, 0, 0)); LinearGradientBrush lgb33 = new LinearGradientBrush(CloseBtn, Color.FromArgb(255, 170, 136), Color.FromArgb(243, 101, 26), 90); G.FillEllipse(lgb33, CloseBtn); G.DrawEllipse(Pens.DimGray, CloseBtn); G.DrawString("r", Font, new SolidBrush(Color.FromArgb(58, 57, 53)), new Rectangle(46, 7, 0, 0)); } break; default: LinearGradientBrush bg4 = new LinearGradientBrush(bgr, Color.FromArgb(60, 59, 55), Color.FromArgb(60, 59, 55), 90); G.FillPath(bg4, Draw.RoundRect(bgr, 10)); LinearGradientBrush lgb14 = new LinearGradientBrush(MinBtn, Color.FromArgb(152, 151, 146), Color.FromArgb(56, 55, 51), 90); G.FillEllipse(lgb14, MinBtn); G.DrawEllipse(Pens.DimGray, MinBtn); G.DrawString("0", Font, new SolidBrush(Color.FromArgb(58, 57, 53)), new Rectangle((int)5.5, 6, 0, 0)); LinearGradientBrush lgb24 = new LinearGradientBrush(MaxBtn, Color.FromArgb(152, 151, 146), Color.FromArgb(56, 55, 51), 90); G.FillEllipse(lgb24, MaxBtn); G.DrawEllipse(Pens.DimGray, MaxBtn); G.DrawString("1", Font, new SolidBrush(Color.FromArgb(58, 57, 53)), new Rectangle(26, 7, 0, 0)); LinearGradientBrush lgb34 = new LinearGradientBrush(CloseBtn, Color.FromArgb(247, 150, 116), Color.FromArgb(223, 81, 6), 90); G.FillEllipse(lgb34, CloseBtn); G.DrawEllipse(Pens.DimGray, CloseBtn); G.DrawString("r", Font, new SolidBrush(Color.FromArgb(58, 57, 53)), new Rectangle(46, 7, 0, 0)); break; } e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0); G.Dispose(); B.Dispose(); }