Helpers.RoundRect Method

public static GraphicsPath RoundRect( 
float x
float y
float w
float h
double r = 0.3, 
bool TL = true, 
bool TR = true, 
bool BR = true, 
bool BL = true 
)
This language is not supported or no code example is available.

Parameters

x
float

y
float

w
float

h
float

r
double

TL
bool

TR
bool

BR
bool

BL
bool

Return Value

GraphicsPath
public static GraphicsPath RoundRect(float x,
     float y,
     float w,
     float h,
     double r = 0.3,
     bool TL = true,
     bool TR = true,
     bool BR = true,
     bool BL = true)
 {
     float num = Math.Min(w, h) * (float)r;
     float num2 = x + w;
     float num3 = y + h;
     GraphicsPath graphicsPath;
     GraphicsPath result = graphicsPath = new GraphicsPath();
     if (TL)
         graphicsPath.AddArc(x, y,
             num, num,
             180f, 90f);
     else
         graphicsPath.AddLine(x, y, x, y);
     if (TR)
         graphicsPath.AddArc(num2 - num, y,
             num, num,
             270f, 90f);
     else
         graphicsPath.AddLine(num2, y,
             num2, y);
     if (BR)
         graphicsPath.AddArc(num2 - num,
             num3 - num, num,
             num,
             0f, 90f);
     else
         graphicsPath.AddLine(num2, num3,
             num2, num3);
     if (BL)
         graphicsPath.AddArc(x, num3 - num,
             num, num,
             90f, 90f);
     else
         graphicsPath.AddLine(x, num3, x, num3);
     graphicsPath.CloseFigure();
     return result;
 }
					
This language is not supported or no code example is available.

.NET Framework

Supported in: 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8

.NET Core

Supported in: 5.0+, 6.0+

In this article

Definition