I created a simple cool ProgressBar control using a tutorial. However, I'm facing an issue. This is my code:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Revarz
{
class GraphicsHelper
{
public GraphicsPath Createround(int X, int Y, int Width, int Height, int CornerRadius)
{
GraphicsPath gfxPath = new GraphicsPath();
try
{
gfxPath.AddArc(X, Y, CornerRadius, CornerRadius, 180, 90);
gfxPath.AddArc(X + Width - CornerRadius, Y, CornerRadius, CornerRadius, 270, 90);
gfxPath.AddArc(X + Width - CornerRadius, Y + Height - CornerRadius, CornerRadius, CornerRadius, 0, 90);
gfxPath.AddArc(X, Y + Height - CornerRadius, CornerRadius, CornerRadius, 90, 90);
gfxPath.CloseAllFigures(); return gfxPath;
}
catch (Exception) { return null; }
}
}
public class CustomProgressbar : Control
{
public int Value { get; set; }
private int _Maximum = 100;
public int Maximum
{
get { return _Maximum; }
set { if (value > 0) { _Maximum = value; } else { throw new Exception("Maximum should be bigger than zero!"); }; }
}
public CustomProgressbar()
{
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.ResizeRedraw, true);
DoubleBuffered = true;
}
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.Clear(BackColor);
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
GraphicsPath barPath = new GraphicsHelper().Createround(0, 0, Width - 1, Height - 1, 3);
e.Graphics.DrawPath(new Pen(Color.FromArgb(50, Color.Black)), barPath);
e.Graphics.SetClip(barPath);
LinearGradientBrush LGB = new LinearGradientBrush(new Rectangle(0, 2, Width - 1, Height - 3), Color.FromArgb(241, 229, 201), Color.FromArgb(237, 218, 202), 90F);
e.Graphics.FillRectangle(LGB, LGB.Rectangle);
e.Graphics.ResetClip();
int DrawWidth = (int)(((double)Value / (double)_Maximum) * (double)(Width - 1));
if (DrawWidth > 1)
{
GraphicsPath FilledPart = new GraphicsHelper().Createround(0, 0, DrawWidth, Height - 1, 3);
LinearGradientBrush LGB2 = new LinearGradientBrush(new Rectangle(0, 1, DrawWidth, Height - 2), Color.FromArgb(232, 119, 9), Color.FromArgb(255, 171, 3), 90F);
e.Graphics.FillRectangle(LGB2, LGB2.Rectangle);
e.Graphics.DrawPath(new Pen(Color.FromArgb(146, 101, 11)), FilledPart);
}
base.OnPaint(e);
}
}
}
The issue is that, when I increase the value, the value doesn't acutally apply (the bar itself, doesn't increase). My firned told me that I have to invalidate the value when it's changed, but I have no idea how to do so!
I'd like some help, thanks!
You need to call the Invalidate() method to force a repaint:
int _value;
public int Value {
get { return _value;}
set {
if(_value != value) {
_value = value;
Invalidate();
}
}
}
Related
I have a custom label class which allows label control to have 4 different backcolors. (this gives the possibility to fill each label backcolor with 4 colors in the same time using .percentageX property).
Everything working nice so far.
public class CustomLabel: System.Windows.Forms.Label
{
private Color m_color1 = Color.LightGreen; //first color
private Color m_color2 = Color.DarkBlue; // second color
private Color m_color3 = Color.Gray; // third color
private Color m_color4 = Color.LightYellow; //fourth color?!
private int Percentagex1 = 30;
private int Percentagex2 = 20;
private int Percentagex3 = 50;
private int Percentagex4 = 0;
public Color Color1
{
get { return m_color1; }
set { m_color1 = value; Invalidate(); }
}
public Color Color2
{
get { return m_color2; }
set { m_color2 = value; Invalidate(); }
}
public Color Color3
{
get { return m_color3; }
set { m_color3 = value; Invalidate(); }
}
public Color Color4
{
get { return m_color4; }
set { m_color4 = value; Invalidate(); }
}
public int Percentage1
{
get { return Percentagex1; }
set { Percentagex1 = value; Invalidate(); }
}
public int Percentage2
{
get { return Percentagex2; }
set { Percentagex2 = value; Invalidate(); }
}
public int Percentage3
{
get { return Percentagex3; }
set { Percentagex3 = value; Invalidate(); }
}
public int Percentage4
{
get { return Percentagex4; }
set { Percentagex4 = value; Invalidate(); }
}
//public Labelhand()
//{
//}
protected override void OnPaint(PaintEventArgs e)
{
int x = Convert.ToInt32(this.Width * Percentagex1 / 100);
int x2 = Convert.ToInt32(this.Width * Percentagex2 / 100);
int x3 = Convert.ToInt32(this.Width * Percentagex3 / 100);
int x4 = Convert.ToInt32(this.Width * Percentagex4 / 100);
SolidBrush brush = new SolidBrush(m_color1);
SolidBrush brush2 = new SolidBrush(m_color2);
SolidBrush brush3 = new SolidBrush(m_color3);
SolidBrush brush4 = new SolidBrush(m_color4);
Graphics g = e.Graphics;
g.FillRectangle(brush, new Rectangle(0, 0, x, this.Height));
g.FillRectangle(brush2, new Rectangle(x, 0, x2, this.Height));
g.FillRectangle(brush3, new Rectangle(x + x2, 0, x3, this.Height));
g.FillRectangle(brush4, new Rectangle(x + x2 + x3, 0, x4, this.Height));
base.OnPaint(e);
}
}
Then, I got another custom label class, this one gives the labels nice rounded corners.
public class RoundedLabel
{
[Browsable(true)]
public Color _BackColor { get; set; }
public RoundedLabel()
{
this.DoubleBuffered = true;
}
private GraphicsPath _getRoundRectangle(Rectangle rectangle)
{
int cornerRadius = 15; // change this value according to your needs
int diminisher = 1;
GraphicsPath path = new GraphicsPath();
path.AddArc(rectangle.X, rectangle.Y, cornerRadius, cornerRadius, 180, 90);
path.AddArc(rectangle.X + rectangle.Width - cornerRadius - diminisher, rectangle.Y, cornerRadius, cornerRadius, 270, 90);
path.AddArc(rectangle.X + rectangle.Width - cornerRadius - diminisher, rectangle.Y + rectangle.Height - cornerRadius - diminisher, cornerRadius, cornerRadius, 0, 90);
path.AddArc(rectangle.X, rectangle.Y + rectangle.Height - cornerRadius - diminisher, cornerRadius, cornerRadius, 90, 90);
path.CloseAllFigures();
return path;
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
using (var graphicsPath = _getRoundRectangle(this.ClientRectangle))
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
using (var brush = new SolidBrush(_BackColor))
e.Graphics.FillPath(brush, graphicsPath);
using (var pen = new Pen(_BackColor, 1.0f))
e.Graphics.DrawPath(pen, graphicsPath);
TextRenderer.DrawText(e.Graphics, Text, this.Font, this.ClientRectangle, this.ForeColor);
}
}
}
This is also working nicely, we set --> label.backcolor = Color.Transparent;
and then the _backcolor property will show a label with rounded corners.
The question comes how to mix these 2 class together to get rounder corners with all 4 colors, but keeping all 4 rounded corners at all times.
I tried to declare the second class like this:
public class RoundedLabel: CustomLabel
Unfortunately, the rounded corners are then only available to the _backcolor property. And not to the color1,2,3,4 ones.
thanks all for any advice!
I was trying to make a normal rounding. And I can't smooth out the rounding itself for the button.
And the second question, how do I round off the button so that the photo that is used in BackgroundImage doesn't get rounded off???
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace Test_Project.SupportClass
{
public class Buttom_Class4 : Button
{
public Buttom_Class4()
{
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
SetStyle(ControlStyles.Opaque, true);
SetStyle(ControlStyles.ResizeRedraw, true);
}
private int radius = 20;
[DefaultValue(20)]
public int Radius
{
get { return radius; }
set
{
radius = value;
this.RecreateRegion();
}
}
private GraphicsPath GetRoundRectagle(Rectangle bounds, int radius)
{
GraphicsPath path = new GraphicsPath();
path.AddArc(bounds.X, bounds.Y, radius, radius, 180, 90);
path.AddArc(bounds.X + bounds.Width - radius, bounds.Y, radius, radius, 270, 90);
path.AddArc(bounds.X + bounds.Width - radius, bounds.Y + bounds.Height - radius,
radius, radius, 0, 90);
path.AddArc(bounds.X, bounds.Y + bounds.Height - radius, radius, radius, 90, 90);
path.CloseAllFigures();
return path;
}
private void RecreateRegion()
{
var bounds = ClientRectangle;
bounds.Width--; bounds.Height--;
using (var path = GetRoundRectagle(bounds, this.Radius))
this.Region = new Region(path);
this.Invalidate();
}
protected override void OnSizeChanged(EventArgs e)
{
base.OnSizeChanged(e);
this.RecreateRegion();
}
}
}
Both labels have AutoSize true & TextAlign MiddleCenter.
How can also label2 show smooth borders?
Here is the test code for handlers Form.Load(...) & Form.Paint(...):
int _cornerRadius = 10;
Point _locationLabel2;
// Form.Load(...)
private void Form3_Load(object sender, EventArgs e)
{
// Step 1: Cut the label regions (seems to be ok, result is the same for both labels)
GraphicsPath graphicsPath = _getRoundPath(label1.ClientRectangle, _cornerRadius);
label1.Region = new Region(graphicsPath);
graphicsPath = _getRoundPath(label2.ClientRectangle, _cornerRadius);
label2.Region = new Region(graphicsPath);
_locationLabel2 = this.PointToClient(label2.Parent.PointToScreen(label2.Location));
}
// Form.Paint(...)
private void Form3_Paint(object sender, PaintEventArgs e)
{
using (Pen pen = new Pen(label1.BackColor, 3.0f))
{
// Step 2: Smooth the label borders (ok only for label1)
_drawRoundedRectangle(e.Graphics, pen, label1.Location.X, label1.Location.Y,
label1.ClientRectangle.Width, label1.ClientRectangle.Height, _cornerRadius);
_drawRoundedRectangle(e.Graphics, pen, _locationLabel2.X, _locationLabel2.Y,
label2.ClientRectangle.Width, label2.ClientRectangle.Height, _cornerRadius);
}
}
// Helper 1/3
private static GraphicsPath _getRoundPath(Rectangle rectangle, int radius)
{
int x = rectangle.X;
int y = rectangle.Y;
int width = rectangle.Width;
int height = rectangle.Height;
radius = radius << 1;
GraphicsPath path = new GraphicsPath();
if (radius > 0)
{
if (radius > height) radius = height;
if (radius > width) radius = width;
path.AddArc(x, y, radius, radius, 180, 90);
path.AddArc(x + width - radius, y, radius, radius, 270, 90);
path.AddArc(x + width - radius, y + height - radius, radius, radius, 0, 90);
path.AddArc(x, y + height - radius, radius, radius, 90, 90);
path.CloseFigure();
}
else
{
path.AddRectangle(rectangle);
}
return path;
}
// Helper 2/3
private void _drawRoundedRectangle(Graphics graphics, Pen pen, int x, int y, int width, int height, int radius)
{
RectangleF rectangle = new RectangleF(x, y, width, height);
GraphicsPath path = _generateRoundedRectangle(graphics, rectangle, radius);
SmoothingMode old = graphics.SmoothingMode;
graphics.SmoothingMode = SmoothingMode.AntiAlias;
graphics.DrawPath(pen, path);
graphics.SmoothingMode = old;
}
// Helper 3/3
private static GraphicsPath _generateRoundedRectangle(Graphics graphics, RectangleF rectangle, int radius)
{
GraphicsPath path = new GraphicsPath();
float diameter = radius * 2.0F;
SizeF sizeF = new SizeF(diameter, diameter);
RectangleF arc = new RectangleF(rectangle.Location, sizeF);
path.AddArc(arc, 180, 90);
arc.X = rectangle.Right - diameter;
path.AddArc(arc, 270, 90);
arc.Y = rectangle.Bottom - diameter;
path.AddArc(arc, 0, 90);
arc.X = rectangle.Left;
path.AddArc(arc, 90, 90);
path.CloseFigure();
return path;
}
Main code parts are from Arun Reginald Zaheeruddin
Solved it according to this answer by #Reza Aghaei.
Solution
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
public class RoundLabel : Label
{
[Browsable(true)]
public Color _BackColor { get; set; }
public RoundLabel()
{
this.DoubleBuffered = true;
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
using (var graphicsPath = _getRoundRectangle(this.ClientRectangle))
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
using (var brush = new SolidBrush(_BackColor))
e.Graphics.FillPath(brush, graphicsPath);
using (var pen = new Pen(_BackColor, 1.0f))
e.Graphics.DrawPath(pen, graphicsPath);
TextRenderer.DrawText(e.Graphics, Text, this.Font, this.ClientRectangle, this.ForeColor);
}
}
private GraphicsPath _getRoundRectangle(Rectangle rectangle)
{
int cornerRadius = 15; // change this value according to your needs
int diminisher = 1;
GraphicsPath path = new GraphicsPath();
path.AddArc(rectangle.X, rectangle.Y, cornerRadius, cornerRadius, 180, 90);
path.AddArc(rectangle.X + rectangle.Width - cornerRadius - diminisher, rectangle.Y, cornerRadius, cornerRadius, 270, 90);
path.AddArc(rectangle.X + rectangle.Width - cornerRadius - diminisher, rectangle.Y + rectangle.Height - cornerRadius - diminisher, cornerRadius, cornerRadius, 0, 90);
path.AddArc(rectangle.X, rectangle.Y + rectangle.Height - cornerRadius - diminisher, cornerRadius, cornerRadius, 90, 90);
path.CloseAllFigures();
return path;
}
}
I have a custom rounded textbox. But I couldn't add the textbox behaviors like text editing, text selection etc. Those properties take much time if I decide make myself. How can I add this properties into my textbox?
My TextBox class:
public class AltoTextBox : Control
{
public AltoTextBox()
{
SetStyle(ControlStyles.AllPaintingInWmPaint |
ControlStyles.SupportsTransparentBackColor |
ControlStyles.OptimizedDoubleBuffer |
ControlStyles.UserPaint, true);
BackColor = Color.Transparent;
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
RoundedRectangleF strokeRect = new RoundedRectangleF(Width, Height, 10);
RoundedRectangleF innerRect = new RoundedRectangleF(Width - 0.5f, Height - 0.5f, 10f, 0.5f, 0.5f);
e.Graphics.DrawPath(Pens.Black, strokeRect.Path);
e.Graphics.FillPath(Brushes.White, innerRect.Path);
}
}
public class RoundedRectangleF
{
Point location;
float radius;
GraphicsPath grPath;
float x, y;
float width, height;
public RoundedRectangleF(float width, float height, float radius,float x = 0,float y = 0)
{
location = new Point(0, 0);
this.radius = radius;
RectangleF upperLeftRect = new RectangleF(x, y, 2 * radius, 2 * radius);
RectangleF upperRightRect = new RectangleF(width - 2 * radius - 1, x, 2 * radius, 2 * radius);
RectangleF lowerLeftRect = new RectangleF(x, height - 2 * radius - 1, 2 * radius, 2 * radius);
RectangleF lowerRightRect = new RectangleF(width - 2 * radius - 1, height - 2 * radius - 1, 2 * radius, 2 * radius);
grPath = new GraphicsPath();
grPath.AddArc(upperLeftRect, 180, 90);
grPath.AddArc(upperRightRect, 270, 90);
grPath.AddArc(lowerRightRect, 0, 90);
grPath.AddArc(lowerLeftRect, 90, 90);
grPath.CloseAllFigures();
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
public RoundedRectangleF()
{
}
public GraphicsPath Path
{
get
{
return grPath;
}
}
public RectangleF Rect
{
get
{
return new RectangleF(x, y, width, height);
}
}
public float Radius
{
get
{
return radius;
}
set
{
radius = value;
}
}
}
I have found a solution from Hazeldev's custom controls.
In this solution we add a textbox control as our child control.
public class AltoTextBox : Control
{
int radius = 15;
public TextBox box = new TextBox();
GraphicsPath Shape;
public AltoTextBox()
{
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.ResizeRedraw, true);
AddTextBox();
Controls.Add(box);
BackColor = Color.Transparent;
ForeColor = Color.DimGray;
Text = null;
Font = new Font("Comic Sans MS", 11);
Size = new Size(135, 33);
DoubleBuffered = true;
}
void AddTextBox()
{
box.Size = new Size(Width - 2*radius, Height - 6);
box.Location = new Point(radius, 3);
box.BorderStyle = BorderStyle.None;
box.TextAlign = HorizontalAlignment.Left;
box.Multiline = true;
box.Font = Font;
}
protected override void OnBackColorChanged(EventArgs e)
{
base.OnBackColorChanged(e);
}
protected override void OnTextChanged(EventArgs e)
{
base.OnTextChanged(e);
box.Text = Text;
}
GraphicsPath innerRect;
protected override void OnFontChanged(EventArgs e)
{
base.OnFontChanged(e);
box.Font = Font;
}
protected override void OnResize(System.EventArgs e)
{
base.OnResize(e);
Shape = new RoundedRectangleF(Width, Height, radius).Path;
innerRect = new RoundedRectangleF(Width - 0.5f, Height - 0.5f, radius, 0.5f, 0.5f).Path;
AddTextBox();
}
protected override void OnPaint(PaintEventArgs e)
{
Bitmap bmp = new Bitmap(Width, Height);
Graphics grp = Graphics.FromImage(bmp);
grp.SmoothingMode = SmoothingMode.HighQuality;
grp.DrawPath(Pens.Gray, Shape);
grp.FillPath(Brushes.White, innerRect);
e.Graphics.DrawImage((Image)bmp.Clone(), 0, 0);
base.OnPaint(e);
}
}
I am working on my custom button in WinForm. I am already done at the work. But I have one last problem that my button doesn't Invalidate the area when a property was changed. I call the Invalidate method in set block and OnResize, but it doesn't work for the button. But it is fixed at runtime or rebuild. How can I fix it?
Here is the a picture for example:
My code:
public class AltoButton : Control
{
int radius;
RoundedRectangle roundedRect;
Color inactive1, inactive2, pressed1, pressed2;
LinearGradientBrush InactiveGB, MouseOverGB, BorderGB, currentGB;
public AltoButton()
{
inactive1 = Color.FromArgb(44, 188, 210);
inactive2 = Color.FromArgb(33, 167, 188);
pressed1 = Color.FromArgb(64, 168, 183);
pressed2 = Color.FromArgb(36, 164, 183);
radius = 10;
roundedRect = new RoundedRectangle(Width, Height, radius);
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer |
ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
}
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
roundedRect = new RoundedRectangle(Width, Height, radius);
InactiveGB = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), inactive1, inactive2, 90f);
MouseOverGB = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), pressed1, pressed2, 90f);
BorderGB = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), Color.FromArgb(162, 120, 101), Color.FromArgb(162, 120, 101), 90f);
if (currentGB == null)
currentGB = InactiveGB;
e.Graphics.FillPath(currentGB, roundedRect.Path);
e.Graphics.DrawPath(new Pen(BorderGB), roundedRect.Path);
}
protected override void OnResize(EventArgs e)
{
Invalidate();
base.OnResize(e);
}
protected override void OnMouseEnter(EventArgs e)
{
currentGB = MouseOverGB;
Invalidate();
base.OnMouseEnter(e);
}
protected override void OnMouseLeave(EventArgs e)
{
base.OnMouseLeave(e);
currentGB = InactiveGB;
Invalidate();
}
public int Radius
{
get
{
return radius;
}
set
{
radius = value;
Invalidate();
}
}
}
public class RoundedRectangle
{
Point location;
int radius;
GraphicsPath grPath;
public RoundedRectangle(int width, int height, int radius)
{
location = new Point(0, 0);
this.radius = radius;
Rectangle upperLeftRect = new Rectangle(0, 0, 2 * radius, 2 * radius);
Rectangle upperRightRect = new Rectangle(width - 2 * radius - 1, 0, 2 * radius, 2 * radius);
Rectangle lowerLeftRect = new Rectangle(0, height - 2 * radius - 1, 2 * radius, 2 * radius);
Rectangle lowerRightRect = new Rectangle(width - 2 * radius - 1, height - 2 * radius - 1, 2 * radius, 2 * radius);
grPath = new GraphicsPath();
grPath.AddArc(upperLeftRect, 180, 90);
grPath.AddArc(upperRightRect, 270, 90);
grPath.AddArc(lowerRightRect, 0, 90);
grPath.AddArc(lowerLeftRect, 90, 90);
grPath.CloseAllFigures();
}
public RoundedRectangle()
{
}
public GraphicsPath Path
{
get
{
return grPath;
}
}
public Rectangle Rect
{
get
{
return new Rectangle(location.X, location.Y, 2 * radius, 2 * radius);
}
}
}
public int Radius
{
get
{
return radius;
}
set
{
radius = value;
Invalidate();
}
}
public Color Inactive1
{
get
{
return inactive1;
}
set
{
inactive1 = value;
Invalidate();
}
}
public Color Inactive2
{
get
{
return inactive2;
}
set
{
inactive2 = value;
Invalidate();
}
}
public Color Pressed1
{
get
{
return pressed1;
}
set
{
pressed1 = value;
Invalidate();
}
}
public Color Pressed2
{
get
{
return pressed2;
}
set
{
pressed2 = value;
Invalidate();
}
}
Remove the OnResize override and include ControlStyles.ResizeRedraw in the styles that you set to true.
Or alternatively set Control.ResizeRedraw property to true.
UPDATE: Actually the problem is more trivial. You have a cached brush in currentGB field which is created using a specific Width and Height.
So you can keep your code the way it is, and just set currentGB to null (you should really be disposing all these brushes, but that's another story) when the size is changed:
protected override void OnResize(EventArgs e)
{
currentGB = null;
Invalidate();
base.OnResize(e);
}
As Ivan said above, I have used using statement to dispose after used. I have added this answer as a complementary solution.
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
roundedRect = new RoundedRectangle(Width, Height, radius);
if (state == MouseState.Leave)
using (LinearGradientBrush inactiveGB = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), inactive1, inactive2, 90f))
e.Graphics.FillPath(inactiveGB, roundedRect.Path);
else if (state == MouseState.Over)
using (LinearGradientBrush activeGB = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), active1, active2, 90f))
e.Graphics.FillPath(activeGB, roundedRect.Path);
using (LinearGradientBrush BorderGB = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), Color.FromArgb(162, 120, 101), Color.FromArgb(162, 120, 101), 90f))
e.Graphics.DrawPath(new Pen(BorderGB), roundedRect.Path);
}
protected override void OnResize(EventArgs e)
{
Invalidate();
base.OnResize(e);
}
protected override void OnMouseEnter(EventArgs e)
{
state = MouseState.Over;
Invalidate();
base.OnMouseEnter(e);
}