本文整理汇总了C#中GraphicsPath.AddLine方法的典型用法代码示例。如果您正苦于以下问题:C# GraphicsPath.AddLine方法的具体用法?C# GraphicsPath.AddLine怎么用?C# GraphicsPath.AddLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphicsPath
的用法示例。
在下文中一共展示了GraphicsPath.AddLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRoundRect
public static GraphicsPath CreateRoundRect(float x, float y, float width, float height, float radius)
{
GraphicsPath gp = new GraphicsPath();
gp.AddLine(x + radius, y, x + width - (radius * 2), y);
gp.AddArc(x + width - (radius * 2), y, radius * 2, radius * 2, 270, 90);
gp.AddLine(x + width, y + radius, x + width, y + height - (radius * 2));
gp.AddArc(x + width - (radius * 2), y + height - (radius * 2), radius * 2, radius * 2, 0, 90);
gp.AddLine(x + width - (radius * 2), y + height, x + radius, y + height);
gp.AddArc(x, y + height - (radius * 2), radius * 2, radius * 2, 90, 90);
gp.AddLine(x, y + height - (radius * 2), x, y + radius);
gp.AddArc(x, y, radius * 2, radius * 2, 180, 90);
gp.CloseFigure();
return gp;
}
示例2: RoundRect
public static GraphicsPath RoundRect(Rectangle rect, int Curve)
{
GraphicsPath P = new GraphicsPath();
int ArcRectWidth = Curve * 2;
P.AddArc(new Rectangle(rect.X, rect.Y, ArcRectWidth, ArcRectWidth), -180, 90);
P.AddArc(new Rectangle(rect.Width - ArcRectWidth + rect.X, rect.Y, ArcRectWidth, ArcRectWidth), -90, 90);
P.AddArc(new Rectangle(rect.Width - ArcRectWidth + rect.X, rect.Height - ArcRectWidth + rect.Y, ArcRectWidth, ArcRectWidth), 0, 90);
P.AddArc(new Rectangle(rect.X, rect.Height - ArcRectWidth + rect.Y, ArcRectWidth, ArcRectWidth), 90, 90);
P.AddLine(new Point(rect.X, rect.Height - ArcRectWidth + rect.Y), new Point(rect.X, Curve + rect.Y));
return P;
}
示例3: DrawBar
private void DrawBar(Graphics objGraphics,
int Value, int BarNumber, string Label)
{
int intLeft = (BarNumber*75)+60;
int intBottom = 275;
int intHeight = (25*Value);
//绘制柱面
objGraphics.FillRectangle(Brushes.Red,intLeft,
intBottom-intHeight,35,intHeight);
//使用GraphicsPath方法绘制柱面顶层
GraphicsPath pthTop = new GraphicsPath();
pthTop.AddLine(intLeft-1, intBottom-intHeight,
intLeft+20, intBottom-intHeight-10);
pthTop.AddLine(intLeft+55,intBottom-
intHeight-10,intLeft+35,
intBottom-intHeight);
objGraphics.FillPath(Brushes.LightSalmon,
pthTop);
// 绘制柱面左侧
GraphicsPath pthRight = new GraphicsPath();
pthRight.AddLine(intLeft+35,intBottom-
intHeight,intLeft+55,intBottom-
intHeight-10);
pthRight.AddLine(intLeft+55,
intBottom-15,intLeft+35,intBottom);
objGraphics.FillPath(Brushes.Firebrick,
pthRight);
//绘制标签
objGraphics.TranslateTransform(intLeft+15,
intBottom-intHeight - 30);
objGraphics.RotateTransform(300);
objGraphics.DrawString(Label,new
Font("Arial",10,FontStyle.Bold),
Brushes.Black,0,0);
objGraphics.ResetTransform();
}
示例4: OnPaint
protected override void OnPaint(PaintEventArgs e)
{
var g = e.Graphics;
g.Clear(Color.White);
using (var dataPointPath = new GraphicsPath())
using (var gridPen = new Pen(Color.FromArgb(20, Color.Black)))
using (var dashPen = new Pen(MainColor) { DashStyle = DashStyle.Dash })
using (var borderPen = new Pen(MainColor))
using (var fillBrush = new SolidBrush(Color.FromArgb(35, MainColor)))
using (var textBrush = new SolidBrush(MainColor))
{
if (DataPoints.Count > 1)
{
var infoRect = new Rectangle();
var highlightRect = new RectangleF();
var infoString = string.Empty;
dataPointPath.AddLine(Width + 10, Height + 10, Width + 10, Height + 10);
var offset = 0;
for (var i = DataPoints.Count - 1; i >= 1; i--)
{
if (DataPoints[i].Index % LineDensity == 0)
g.DrawLine(gridPen, Width - offset, 0, Width - offset, Height);
var scaledY = GetScaledPoint(DataPoints[i].Value);
dataPointPath.AddLine(Width - offset, scaledY, Width - offset - PointDensity,
GetScaledPoint(DataPoints[i - 1].Value));
if (HighlightPoint && new Rectangle(Width - offset - (PointDensity / 2), 0, PointDensity, Height).Contains(MouseLocation))
{
g.DrawLine(gridPen, 0, scaledY, Width, scaledY);
highlightRect = new RectangleF(Width - offset - 3, scaledY - 3, 6, 6);
infoString = DataPoints[i].Value.ToString(CultureInfo.InvariantCulture);
var infoStringSize = TextRenderer.MeasureText(infoString, Font);
infoRect = new Rectangle
{
Height = infoStringSize.Height + 2,
Width = infoStringSize.Width + 5
};
if (offset < infoStringSize.Width + 10)
infoRect.X = Width - offset - infoStringSize.Width - 10;
else
infoRect.X = Width - offset + 5;
if (scaledY > Height - infoStringSize.Height - 5)
infoRect.Y = (int)scaledY - infoStringSize.Height - 5;
else
infoRect.Y = (int)scaledY + 5;
}
offset += PointDensity;
}
dataPointPath.AddLine(-10, Height + 10, -10, Height + 10);
dataPointPath.CloseFigure();
g.SmoothingMode = SmoothingMode.AntiAlias;
g.FillPath(fillBrush, dataPointPath);
g.DrawPath(borderPen, dataPointPath);
g.SmoothingMode = SmoothingMode.None;
if (ShowAverage)
{
var average = GetScaledPoint(GetAverage());
g.DrawLine(dashPen, 0, average, Width, average);
g.FillRectangle(fillBrush, 0, average, Width, Height - average);
}
if (HighlightPoint)
{
g.SmoothingMode = SmoothingMode.AntiAlias;
g.FillEllipse(Brushes.White, highlightRect);
g.DrawEllipse(borderPen, highlightRect);
g.SmoothingMode = SmoothingMode.None;
g.FillRectangle(Brushes.White, infoRect);
g.DrawRectangle(borderPen, infoRect);
g.DrawString(infoString, HighlightFont, textBrush, infoRect.X + 4, infoRect.Y + 1);
}
}
g.DrawRectangle(borderPen, new Rectangle(0, 0, Width - 1, Height - 1));
}
}
示例5: CreateRoundedRectangleRegion
private Region CreateRoundedRectangleRegion(int radius, Rectangle rectangle)
{
using (GraphicsPath Path = new GraphicsPath())
{
int Radius2 = (radius * 2);
Path.FillMode = FillMode.Winding;
Path.StartFigure();
Path.AddArc(rectangle.X, rectangle.Y, Radius2, Radius2, 180, 90);
Path.AddLine(rectangle.X + radius, rectangle.Y, rectangle.Right - radius, rectangle.Y);
Path.AddArc(rectangle.Right - Radius2 - 1, rectangle.Y, Radius2, Radius2, 270, 90);
Path.AddLine(rectangle.Right, rectangle.Y + radius, rectangle.Right, rectangle.Bottom - radius);
Path.AddArc(rectangle.Right - Radius2 - 1, rectangle.Bottom - Radius2 - 1, Radius2, Radius2, 0, 90);
Path.AddLine(rectangle.Right - radius, rectangle.Bottom, rectangle.X + radius, rectangle.Bottom);
Path.AddArc(rectangle.X, rectangle.Bottom - Radius2 - 1, Radius2, Radius2, 90, 90);
Path.AddLine(rectangle.X, rectangle.Bottom - radius, rectangle.X, rectangle.Y + radius);
Path.CloseFigure();
return new Region(Path);
}
}
示例6: MakeRoundedCorners
private static Image MakeRoundedCorners(Image image, int radius)
{
Bitmap bmp = new Bitmap(image, image.Width, image.Height);
using (Graphics g = Graphics.FromImage(bmp))
{
Brush brush = new SolidBrush(Color.White);
for (int i = 0; i < 4; i++)
{
Point[] cornerUpLeft = new Point[3];
cornerUpLeft[0].X = 0;
cornerUpLeft[0].Y = 0;
cornerUpLeft[1].X = radius;
cornerUpLeft[1].Y = 0;
cornerUpLeft[2].X = 0;
cornerUpLeft[2].Y = radius;
GraphicsPath pathCornerUpLeft = new GraphicsPath();
pathCornerUpLeft.AddArc(cornerUpLeft[0].X, cornerUpLeft[0].Y,
radius, radius, 180, 90);
pathCornerUpLeft.AddLine(cornerUpLeft[0].X, cornerUpLeft[0].Y,
cornerUpLeft[1].X, cornerUpLeft[1].Y);
pathCornerUpLeft.AddLine(cornerUpLeft[0].X, cornerUpLeft[0].Y,
cornerUpLeft[2].X, cornerUpLeft[2].Y);
g.FillPath(brush, pathCornerUpLeft);
pathCornerUpLeft.Dispose();
bmp.RotateFlip(RotateFlipType.Rotate90FlipNone);
}
brush.Dispose();
g.Dispose();
}
return bmp;
}
示例7: DrawData
// REAL MAGIC HERE! y- B-
private void DrawData(Graphics g, float Xunit, float Yunit,int xstart )
{
PeptideMW PMW = new PeptideMW(PeptideSequence);
float[] Bs = PMW.GetPepFragmentBValues();
float[] Ys = PMW.GetPepFragmentYValues();
bool bPhos = PMW.IsPhosphorylation();
int Count = SpectrumData.Count;
int i = 0;
for (i = 0; i < Count; i++)
{
float mz = ((MZintensitiy )SpectrumData[i]).mz ;
float intensity = ((MZintensitiy )SpectrumData[i]).intensity ;
float x = (mz - xstart)*Xunit + NETAREALEFTMARGIN ;
float y;
if (bZoomOut)
{
if (intensity * 100 / MaxIntensitiy > DisplayMaxY)
{
y = NETAREATOPMARGIN ;
}
else
{
y = HEIGHT - NETAREABOTTOMMARGIN - intensity * 100 * Yunit / MaxIntensitiy;
}
}
else
y = HEIGHT - NETAREABOTTOMMARGIN - intensity * 100 * Yunit / MaxIntensitiy;
Pen dataPen = new Pen (Brushes.Black ,1);
Pen BLinePen = new Pen(Brushes.Blue, 2);
Pen YLinePen = new Pen(Brushes.Red, 2);
Pen ALinePen = new Pen (Brushes.Green ,2);
Pen MLinePen = new Pen(Brushes.Gray , 2);
Font Numberfont = new Font("Arial", 9, FontStyle.Regular);
if (y < HEIGHT - NETAREABOTTOMMARGIN -20 && bShowLabel )
{
string strAnn = GetAnnotation(SpectrumData,i, Bs, Ys,PrecursorMZ,int.Parse (ChargeState ),bPhos );
if (strAnn.StartsWith("(b"))
{
g.DrawLine(BLinePen, x, y, x, (float)HEIGHT - NETAREABOTTOMMARGIN);
g.DrawString(strAnn, Numberfont, Brushes.Blue , new PointF(x, y));
}
else if (strAnn.StartsWith("(y"))
{
g.DrawLine(YLinePen, x, y, x, (float)HEIGHT - NETAREABOTTOMMARGIN);
g.DrawString(strAnn, Numberfont, Brushes.Red, new PointF(x, y));
}
else if (strAnn.StartsWith("(a"))
{
g.DrawLine(ALinePen, x, y, x, (float)HEIGHT - NETAREABOTTOMMARGIN);
g.DrawString(strAnn, Numberfont, Brushes.Green, new PointF(x, y));
}
else if (strAnn.StartsWith("(M") && y < HEIGHT - NETAREABOTTOMMARGIN -100)
{
g.DrawLine(MLinePen, x, y, x, (float)HEIGHT - NETAREABOTTOMMARGIN);
g.DrawString(strAnn, Numberfont, Brushes.Gray , new PointF(x, y));
}
else
{
g.DrawLine(dataPen, x, y, x, (float)HEIGHT - NETAREABOTTOMMARGIN);
}
//g.DrawString(strAnn, Numberfont, Brushes.Red, new PointF(x, y));
}
else
g.DrawLine(dataPen, x, y, x, (float)HEIGHT - NETAREABOTTOMMARGIN);
if (intensity == MaxIntensitiy)
{
//peak value point
GraphicsPath p = new GraphicsPath();
p.AddLine(x, (float)HEIGHT - NETAREABOTTOMMARGIN, x + XAxisScaleLength, (float)HEIGHT - NETAREABOTTOMMARGIN + XAxisScaleLength);
p.AddLine(x + XAxisScaleLength, (float)HEIGHT - NETAREABOTTOMMARGIN + XAxisScaleLength, x - XAxisScaleLength, (float)HEIGHT - NETAREABOTTOMMARGIN + XAxisScaleLength);
p.CloseFigure();
g.FillPath(Brushes.Red, p);
g.DrawString(mz.ToString(), Numberfont, Brushes.Red, x + XAxisScaleLength, (float)HEIGHT - NETAREABOTTOMMARGIN);
}
}
}
示例8: GetValueRec
public GraphicsPath GetValueRec()
{
GraphicsPath gp = new GraphicsPath();
gp.AddArc((float)((.05f) * vm.Width), (float)((1f / 3f) * vm.Height), (float)(.90f) * vm.Width, (float)(1.2f) * vm.Height, -180f, 180f);
gp.AddLine((float)((.05f) * vm.Width), (float)((70f / 75f) * vm.Height), (float)(.95f) * vm.Width, (float)((70f / 75f) * vm.Height));
return gp;
}
示例9: RoundRect
private GraphicsPath RoundRect(RectangleF r, float r1, float r2, float r3, float r4)
{
float x = r.X, y = r.Y, w = r.Width, h = r.Height;
GraphicsPath rr = new GraphicsPath();
rr.AddBezier(x, y + r1, x, y, x + r1, y, x + r1, y);
rr.AddLine(x + r1, y, x + w - r2, y);
rr.AddBezier(x + w - r2, y, x + w, y, x + w, y + r2, x + w, y + r2);
rr.AddLine(x + w, y + r2, x + w, y + h - r3);
rr.AddBezier(x + w, y + h - r3, x + w, y + h, x + w - r3, y + h, x + w - r3, y + h);
rr.AddLine(x + w - r3, y + h, x + r4, y + h);
rr.AddBezier(x + r4, y + h, x, y + h, x, y + h - r4, x, y + h - r4);
rr.AddLine(x, y + h - r4, x, y + r1);
return rr;
}
示例10: RoundRectangle
private GraphicsPath RoundRectangle(Rectangle r, int radius, GroupBoxCorners corners)
{
GraphicsPath path = new GraphicsPath();
if (r.Width <= 0 | r.Height <= 0)
return path;
int d = radius * 2;
int nw = ((corners & GroupBoxCorners.NorthWest) == GroupBoxCorners.NorthWest ? d : 0);
int ne = ((corners & GroupBoxCorners.NorthEast) == GroupBoxCorners.NorthEast ? d : 0);
int se = ((corners & GroupBoxCorners.SouthEast) == GroupBoxCorners.SouthEast ? d : 0);
int sw = ((corners & GroupBoxCorners.SouthWest) == GroupBoxCorners.SouthWest ? d : 0);
path.AddLine(r.Left + nw, r.Top, r.Right - ne, r.Top);
if (ne > 0)
{
path.AddArc(Rectangle.FromLTRB(r.Right - ne, r.Top, r.Right, r.Top + ne), -90, 90);
}
path.AddLine(r.Right, r.Top + ne, r.Right, r.Bottom - se);
if (se > 0)
{
path.AddArc(Rectangle.FromLTRB(r.Right - se, r.Bottom - se, r.Right, r.Bottom), 0, 90);
}
path.AddLine(r.Right - se, r.Bottom, r.Left + sw, r.Bottom);
if (sw > 0)
{
path.AddArc(Rectangle.FromLTRB(r.Left, r.Bottom - sw, r.Left + sw, r.Bottom), 90, 90);
}
path.AddLine(r.Left, r.Bottom - sw, r.Left, r.Top + nw);
if (nw > 0)
{
path.AddArc(Rectangle.FromLTRB(r.Left, r.Top, r.Left + nw, r.Top + nw), 180, 90);
}
path.CloseFigure();
return path;
}
示例11: DrawClose
private void DrawClose(int x, int y)
{
if (ClosePath == null)
{
ClosePath = new GraphicsPath();
ClosePath.AddLine(x + 1, y, x + 3, y);
ClosePath.AddLine(x + 5, y + 2, x + 7, y);
ClosePath.AddLine(x + 9, y, x + 10, y + 1);
ClosePath.AddLine(x + 7, y + 4, x + 7, y + 5);
ClosePath.AddLine(x + 10, y + 8, x + 9, y + 9);
ClosePath.AddLine(x + 7, y + 9, x + 5, y + 7);
ClosePath.AddLine(x + 3, y + 9, x + 1, y + 9);
ClosePath.AddLine(x + 0, y + 8, x + 3, y + 5);
ClosePath.AddLine(x + 3, y + 4, x + 0, y + 1);
}
G.FillPath(Brushes.White, ClosePath);
G.DrawPath(Pens.Black, ClosePath);
}
示例12: panel1_Paint
public void panel1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
g.SmoothingMode = SmoothingMode.HighQuality;
Pen p = new Pen(c.GetPanel1().ForeColor, 3);
p.LineJoin = LineJoin.Bevel;
string selectedData = "" + c.GetComboBox1().SelectedItem;
SizeF stringsize = g.MeasureString(selectedData, c.GetPanel1().Font);
g.DrawString(selectedData, c.GetPanel1().Font, p.Brush, new Point(c.GetPanel1().Width - (int)stringsize.Width, 0));
Console.WriteLine(selectedData);
switch (c.GetComboBox1().SelectedIndex)
{
case 0:
{
g.TranslateTransform(0, c.GetPanel1().Height);
Point newPoint = new Point(c.GetPanel1().Width, (int)-(c.getData().heartRate / 1.5 + 5));
PointsHeartrate.Add(newPoint);
GraphicsPath path = new GraphicsPath();
path.StartFigure();
for (int i = 0; i < PointsHeartrate.Count; i++)
{
Point point = PointsHeartrate[i];
point.X -= 4;
path.AddLine(oldPoint, point);
oldPoint = point;
PointsHeartrate[i] = point;
}
for (int j = PointsHeartrate.Count - 1; j > 0; j--)
{
Point point = PointsHeartrate[j];
path.AddLine(oldPoint, point);
oldPoint = point;
PointsHeartrate[j] = point;
}
g.DrawPath(p, path);
for (int k = 0; k < PointsHeartrate.Count; k++)
{
if (PointsHeartrate[k].X < 0)
{
PointsHeartrate.RemoveAt(k);
}
}
break;
}
case 1:
{
g.TranslateTransform(0, c.GetPanel1().Height);
Point newPoint = new Point(c.GetPanel1().Width, (int)-(c.getData().RPM / 1.2 + 5));
this.PointsRPM.Add(newPoint);
GraphicsPath path = new GraphicsPath();
path.StartFigure();
for (int i = 0; i < this.PointsRPM.Count; i++)
{
Point point = this.PointsRPM[i];
point.X -= 4;
path.AddLine(oldPoint, point);
oldPoint = point;
this.PointsRPM[i] = point;
}
for (int j = this.PointsRPM.Count - 1; j > 0; j--)
{
Point point = this.PointsRPM[j];
path.AddLine(oldPoint, point);
oldPoint = point;
this.PointsRPM[j] = point;
}
g.DrawPath(p, path);
for (int k = 0; k < this.PointsRPM.Count; k++)
{
if (this.PointsRPM[k].X < 0)
{
this.PointsRPM.RemoveAt(k);
}
}
break;
}
case 2:
{
g.TranslateTransform(0, c.GetPanel1().Height);
Point newPoint = new Point(c.GetPanel1().Width, (int)-((int)c.getData().speed / (4.2 / 10) + 5));
this.PointsSpeed.Add(newPoint);
GraphicsPath path = new GraphicsPath();
path.StartFigure();
for (int i = 0; i < this.PointsSpeed.Count; i++)
{
Point point = this.PointsSpeed[i];
point.X -= 4;
path.AddLine(oldPoint, point);
oldPoint = point;
this.PointsSpeed[i] = point;
}
for (int j = this.PointsSpeed.Count - 1; j > 0; j--)
{
Point point = this.PointsSpeed[j];
path.AddLine(oldPoint, point);
oldPoint = point;
this.PointsSpeed[j] = point;
}
g.DrawPath(p, path);
//.........这里部分代码省略.........
示例13: RoundRect
public GraphicsPath RoundRect(Rectangle Rectangle, int Curve)
{
GraphicsPath P = new GraphicsPath();
int ArcRectangleWidth = Curve * 2;
P.AddArc(new Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90);
P.AddArc(new Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90);
P.AddArc(new Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90);
P.AddArc(new Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90);
P.AddLine(new Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), new Point(Rectangle.X, Curve + Rectangle.Y));
return P;
}
示例14: DrawDocumentTab
public static void DrawDocumentTab(Graphics g, Rectangle rect, Color backColorBegin, Color backColorEnd, Color edgeColor, TabDrawType tabType, bool closed)
{
GraphicsPath path;
Region Region;
Brush brush = null;
Pen pen;
brush = new LinearGradientBrush(rect, backColorBegin, backColorEnd, LinearGradientMode.Vertical);
pen = new pen(edgeColor, 1.0F);
path = new GraphicsPath();
if (tabType == TabDrawType.First)
{
path.AddLine(rect.Left + 1, rect.Bottom + 1, rect.Left + rect.Height, rect.Top + 2);
path.AddLine(rect.Left + rect.Height + 4, rect.Top, rect.Right - 3, rect.Top);
path.AddLine(rect.Right - 1, rect.Top + 2, rect.Right - 1, rect.Bottom + 1);
}
else
{
if (tabType == TabDrawType.Active)
{
path.AddLine(rect.Left + 1, rect.Bottom + 1, rect.Left + rect.Height, rect.Top + 2);
path.AddLine(rect.Left + rect.Height + 4, rect.Top, rect.Right - 3, rect.Top);
path.AddLine(rect.Right - 1, rect.Top + 2, rect.Right - 1, rect.Bottom + 1);
}
else
{
path.AddLine(rect.Left, rect.Top + 6, rect.Left + 4, rect.Top + 2);
path.AddLine(rect.Left + 8, rect.Top, rect.Right - 3, rect.Top);
path.AddLine(rect.Right - 1, rect.Top + 2, rect.Right - 1, rect.Bottom + 1);
path.AddLine(rect.Right - 1, rect.Bottom + 1, rect.Left, rect.Bottom + 1);
}
}
Region = new Region(path);
g.FillRegion(brush, Region);
g.DrawPath(pen, path);
}
示例15: RoundRect
public static GraphicsPath RoundRect(Rectangle Rect, int Rounding, RoundingStyle Style = RoundingStyle.All)
{
GraphicsPath GP = new GraphicsPath();
int AW = Rounding * 2;
GP.StartFigure();
if (Rounding == 0)
{
GP.AddRectangle(Rect);
GP.CloseAllFigures();
return GP;
}
switch (Style)
{
case RoundingStyle.All:
GP.AddArc(new Rectangle(Rect.X, Rect.Y, AW, AW), -180, 90);
GP.AddArc(new Rectangle(Rect.Width - AW + Rect.X, Rect.Y, AW, AW), -90, 90);
GP.AddArc(new Rectangle(Rect.Width - AW + Rect.X, Rect.Height - AW + Rect.Y, AW, AW), 0, 90);
GP.AddArc(new Rectangle(Rect.X, Rect.Height - AW + Rect.Y, AW, AW), 90, 90);
break;
case RoundingStyle.Top:
GP.AddArc(new Rectangle(Rect.X, Rect.Y, AW, AW), -180, 90);
GP.AddArc(new Rectangle(Rect.Width - AW + Rect.X, Rect.Y, AW, AW), -90, 90);
GP.AddLine(new Point(Rect.X + Rect.Width, Rect.Y + Rect.Height), new Point(Rect.X, Rect.Y + Rect.Height));
break;
case RoundingStyle.Bottom:
GP.AddLine(new Point(Rect.X, Rect.Y), new Point(Rect.X + Rect.Width, Rect.Y));
GP.AddArc(new Rectangle(Rect.Width - AW + Rect.X, Rect.Height - AW + Rect.Y, AW, AW), 0, 90);
GP.AddArc(new Rectangle(Rect.X, Rect.Height - AW + Rect.Y, AW, AW), 90, 90);
break;
case RoundingStyle.Left:
GP.AddArc(new Rectangle(Rect.X, Rect.Y, AW, AW), -180, 90);
GP.AddLine(new Point(Rect.X + Rect.Width, Rect.Y), new Point(Rect.X + Rect.Width, Rect.Y + Rect.Height));
GP.AddArc(new Rectangle(Rect.X, Rect.Height - AW + Rect.Y, AW, AW), 90, 90);
break;
case RoundingStyle.Right:
GP.AddLine(new Point(Rect.X, Rect.Y + Rect.Height), new Point(Rect.X, Rect.Y));
GP.AddArc(new Rectangle(Rect.Width - AW + Rect.X, Rect.Y, AW, AW), -90, 90);
GP.AddArc(new Rectangle(Rect.Width - AW + Rect.X, Rect.Height - AW + Rect.Y, AW, AW), 0, 90);
break;
case RoundingStyle.TopRight:
GP.AddLine(new Point(Rect.X, Rect.Y + 1), new Point(Rect.X, Rect.Y));
GP.AddArc(new Rectangle(Rect.Width - AW + Rect.X, Rect.Y, AW, AW), -90, 90);
GP.AddLine(new Point(Rect.X + Rect.Width, Rect.Y + Rect.Height - 1), new Point(Rect.X + Rect.Width, Rect.Y + Rect.Height));
GP.AddLine(new Point(Rect.X + 1, Rect.Y + Rect.Height), new Point(Rect.X, Rect.Y + Rect.Height));
break;
case RoundingStyle.BottomRight:
GP.AddLine(new Point(Rect.X, Rect.Y + 1), new Point(Rect.X, Rect.Y));
GP.AddLine(new Point(Rect.X + Rect.Width - 1, Rect.Y), new Point(Rect.X + Rect.Width, Rect.Y));
GP.AddArc(new Rectangle(Rect.Width - AW + Rect.X, Rect.Height - AW + Rect.Y, AW, AW), 0, 90);
GP.AddLine(new Point(Rect.X + 1, Rect.Y + Rect.Height), new Point(Rect.X, Rect.Y + Rect.Height));
break;
}
GP.CloseAllFigures();
return GP;
}