Hi,
Do you mean the internal AddRoundRect method? I guess just add a copy to your derived class, we'll make it protected for next release -
public override void Draw(Graphics grpx, Key key, Mode mode, Font font)
{
.....
var path = new GraphicsPath();
AddRoundRect(r, CornerRadius, path);
//grpx.FillRectangle(br, new Rectangle((int)key.Left, (int)key.Top, (int)key.Width, (int)key.Height));
PathGradientBrush pgb = new PathGradientBrush(path);
pgb.CenterPoint = new PointF(
(float)(key.Left + key.Width / 2),
(float)(key.Top + key.Height / 2));
pgb.CenterColor = Color.White;
pgb.SurroundColors = new Color[] { Color.Red };
grpx.FillPath(pgb, path);
.....
grpx.DrawPath(Border, path);
}
static GraphicsPath AddRoundRect(
Rectangle rect, float r, GraphicsPath gp)
{
float x = rect.X;
float y = rect.Y;
float width = rect.Width;
float height = rect.Height;
try
{
float diameter = Math.Min(2 * r, Math.Min(width, height));
r = diameter / 2;
if (diameter < width)
gp.AddLine(x + r, y, x + width - r, y);
if (r > 0)
gp.AddArc(x + width - diameter, y, diameter, diameter, 270, 90);
if (diameter < height)
gp.AddLine(x + width, y + r, x + width, y + height - r);
if (r > 0)
gp.AddArc(x + width - diameter, y + height - diameter, diameter, diameter, 0, 90);
if (diameter < width)
gp.AddLine(x + width - r, y + height, x + r, y + height);
if (r > 0)
gp.AddArc(x, y + height - diameter, diameter, diameter, 90, 90);
if (diameter < height)
gp.AddLine(x, y + height - r, x, y + r);
if (r > 0)
gp.AddArc(x, y, diameter, diameter, 180, 90);
gp.CloseFigure();
}
catch (Exception)
{
gp.AddRectangle(rect);
}
return gp;
}
You can find more gradient examples here -
https://www.codeproject.com/Articles/20018/Gradients-made-easyhttp://www.functionx.com/vbnet/gdi/gradientbrush.htmRegards,
Slavcho
Mindfusion