public static void InnerGlowRounded(Graphics G, Rectangle Rectangle, int Degree, Color[] Colors) { int SubtractTwo = 1; int AddOne = 0; foreach (Color c_loopVariable in Colors) { Color c = c_loopVariable; G.DrawPath(new Pen(new SolidBrush(Color.FromArgb(c.R, c.B, c.G))), Draw.CreateRound(Rectangle.X + AddOne, Rectangle.Y + AddOne, Rectangle.Width - SubtractTwo, Rectangle.Height - SubtractTwo, Degree)); SubtractTwo += 2; AddOne += 1; } }
protected override void OnPaint(PaintEventArgs e) { Bitmap B = new Bitmap(Width, Height); Graphics G = Graphics.FromImage(B); G = Graphics.FromImage(B); W = Width - 1; H = Height - 1; Rectangle Base = new Rectangle(0, 0, W, H); var _with1 = G; _with1.SmoothingMode = SmoothingMode.HighQuality; _with1.Clear(BackColor); TB.BackColor = _BaseColor; TB.ForeColor = _TextColor; switch (_Style) { case RoundingStyle.Normal: _with1.FillPath(new SolidBrush(_BaseColor), Draw.CreateRound(Base, 5)); LinearGradientBrush tg = new LinearGradientBrush(Base, Color.FromArgb(186, 188, 191), Color.FromArgb(204, 205, 209), 90); _with1.DrawPath(new Pen(tg), Draw.CreateRound(Base, 5)); break; case RoundingStyle.Rounded: _with1.DrawPath(new Pen(new SolidBrush(Color.FromArgb(132, 130, 128))), Draw.CreateRound(new Rectangle(Base.X, Base.Y + 1, Base.Width, Base.Height - 1), 20)); _with1.FillPath(new SolidBrush(_BaseColor), Draw.CreateRound(new Rectangle(Base.X, Base.Y, Base.Width, Base.Height - 1), 20)); LinearGradientBrush tg1 = new LinearGradientBrush(new Rectangle(Base.X, Base.Y, Base.Width, Base.Height - 1), Color.Black, Color.FromArgb(31, 28, 24), 90); _with1.DrawPath(new Pen(tg1), Draw.CreateRound(new Rectangle(Base.X, Base.Y, Base.Width, Base.Height - 1), 20)); break; } base.OnPaint(e); G.Dispose(); e.Graphics.InterpolationMode = (InterpolationMode)7; e.Graphics.DrawImageUnscaled(B, 0, 0); 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(3, 3, Width - 7, Height - 7); base.OnPaint(e); G.Clear(BackColor); G.SmoothingMode = SmoothingMode.HighQuality; switch (_Shade) { case InnerShade.Dark: G.FillPath(InnerTexture, Draw.CreateRound(ClientRectangle, 3)); G.DrawPath(Draw.GetPen(Color.FromArgb(40, 38, 36)), Draw.CreateRound(new Rectangle(3, 3, Width - 6, Height - 6), 3)); G.DrawPath(Draw.GetPen(Color.FromArgb(45, 43, 41)), Draw.CreateRound(new Rectangle(3, 3, Width - 6, Height - 5), 3)); G.DrawPath(Draw.GetPen(Color.FromArgb(50, 48, 46)), Draw.CreateRound(new Rectangle(2, 2, Width - 5, Height - 3), 3)); LinearGradientBrush HighlightGradient = new LinearGradientBrush(new Rectangle(4, 4, Width - 8, Height - 8), Color.FromArgb(160, 158, 157), Color.FromArgb(61, 57, 54), 90); Pen hp = new Pen(HighlightGradient); G.DrawPath(hp, Draw.CreateRound(new Rectangle(4, 4, Width - 9, Height - 9), 3)); LinearGradientBrush OutlineGradient = new LinearGradientBrush(new Rectangle(3, 3, Width - 7, Height - 6), Color.FromArgb(34, 32, 30), Color.Black, 90); Pen op = new Pen(OutlineGradient); G.DrawPath(op, Draw.CreateRound(new Rectangle(3, 3, Width - 7, Height - 7), 3)); Font drawFont = new Font("Arial", 9, FontStyle.Bold); switch (State) { case MouseState.None: G.DrawString(Text, drawFont, Brushes.White, new Rectangle(0, 0, Width - 1, Height - 1), new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); break; case MouseState.Over: G.DrawString(Text, drawFont, Brushes.White, new Rectangle(0, 0, Width - 1, Height - 1), new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); break; case MouseState.Down: G.DrawString(Text, drawFont, Brushes.White, new Rectangle(0, 0, Width - 1, Height - 1), new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); break; } break; case InnerShade.Light: LinearGradientBrush MainGradient = new LinearGradientBrush(ClientRectangle, Color.FromArgb(225, 227, 230), Color.FromArgb(199, 201, 204), 90); G.FillPath(MainGradient, Draw.CreateRound(ClientRectangle, 3)); G.DrawPath(Draw.GetPen(Color.FromArgb(167, 168, 171)), Draw.CreateRound(new Rectangle(3, 3, Width - 6, Height - 6), 3)); G.DrawPath(Draw.GetPen(Color.FromArgb(203, 205, 208)), Draw.CreateRound(new Rectangle(2, 2, Width - 5, Height - 4), 3)); LinearGradientBrush HighlightGradient1 = new LinearGradientBrush(new Rectangle(4, 4, Width - 8, Height - 8), Color.FromArgb(255, 255, 255), Color.FromArgb(218, 219, 222), 90); Pen hp1 = new Pen(HighlightGradient1); G.DrawPath(hp1, Draw.CreateRound(new Rectangle(4, 4, Width - 9, Height - 9), 3)); LinearGradientBrush OutlineGradient1 = new LinearGradientBrush(new Rectangle(3, 3, Width - 7, Height - 6), Color.FromArgb(173, 174, 177), Color.FromArgb(110, 111, 114), 90); Pen op1 = new Pen(OutlineGradient1); G.DrawPath(op1, Draw.CreateRound(new Rectangle(3, 3, Width - 7, Height - 7), 3)); Font drawFont1 = new Font("Arial", 9, FontStyle.Bold); switch (State) { case MouseState.None: G.DrawString(Text, drawFont1, Draw.GetBrush(Color.FromArgb(109, 109, 110)), new Rectangle(0, 0, Width - 1, Height - 1), new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); break; case MouseState.Over: G.DrawString(Text, drawFont1, Draw.GetBrush(Color.FromArgb(109, 109, 110)), new Rectangle(0, 0, Width - 1, Height - 1), new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); break; case MouseState.Down: G.DrawString(Text, drawFont1, Draw.GetBrush(Color.FromArgb(109, 109, 110)), new Rectangle(0, 0, Width - 1, Height - 1), new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); break; } break; } e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0); G.Dispose(); B.Dispose(); }