StartFigure() public method

public StartFigure ( ) : void
return void
 //----------------------------
 public override void ReEvaluateComputeValue(ref ReEvaluateArgs args)
 {
     var myspec = this.spec;
     this.fillColor = myspec.ActualColor;
     this.strokeColor = myspec.StrokeColor;
     this.ActualX = ConvertToPx(myspec.X, ref args);
     this.ActualY = ConvertToPx(myspec.Y, ref args);
     this.ActualRadius = ConvertToPx(myspec.Radius, ref args);
     this.ActualStrokeWidth = ConvertToPx(myspec.StrokeWidth, ref args);
     //create new path
     if (this.IsPathValid) { return; }
     ClearCachePath();
     myCachedPath = new GraphicsPath();
     myCachedPath.StartFigure();
     myCachedPath.AddEllipse(this.ActualX - this.ActualRadius, this.ActualY - this.ActualRadius, 2 * this.ActualRadius, 2 * ActualRadius);
     myCachedPath.CloseFigure();
     ValidatePath();
 }
Beispiel #2
0
 static GraphicsPath CreateRectGraphicPath(float x, float y, float w, float h)
 {
     var _path = new GraphicsPath();
     _path.StartFigure();
     _path.AddRectangle(new RectangleF(x, y, w, h));
     _path.CloseFigure();
     return _path;
 }
 static GraphicsPath CreateRoundRectGraphicPath(float x, float y, float w, float h, float c_rx, float c_ry)
 {
     var _path = new GraphicsPath();
     var arcBounds = new RectangleF();
     var lineStart = new PointF();
     var lineEnd = new PointF();
     var width = w;
     var height = h;
     var rx = c_rx * 2;
     var ry = c_ry * 2;
     // Start
     _path.StartFigure();
     // Add first arc
     arcBounds.Location = new PointF(x, y);
     arcBounds.Width = rx;
     arcBounds.Height = ry;
     _path.AddArc(arcBounds, 180, 90);
     // Add first line
     lineStart.X = Math.Min(x + rx, x + width * 0.5f);
     lineStart.Y = y;
     lineEnd.X = Math.Max(x + width - rx, x + width * 0.5f);
     lineEnd.Y = lineStart.Y;
     _path.AddLine(lineStart, lineEnd);
     // Add second arc
     arcBounds.Location = new PointF(x + width - rx, y);
     _path.AddArc(arcBounds, 270, 90);
     // Add second line
     lineStart.X = x + width;
     lineStart.Y = Math.Min(y + ry, y + height * 0.5f);
     lineEnd.X = lineStart.X;
     lineEnd.Y = Math.Max(y + height - ry, y + height * 0.5f);
     _path.AddLine(lineStart, lineEnd);
     // Add third arc
     arcBounds.Location = new PointF(x + width - rx, y + height - ry);
     _path.AddArc(arcBounds, 0, 90);
     // Add third line
     lineStart.X = Math.Max(x + width - rx, x + width * 0.5f);
     lineStart.Y = y + height;
     lineEnd.X = Math.Min(x + rx, x + width * 0.5f);
     lineEnd.Y = lineStart.Y;
     _path.AddLine(lineStart, lineEnd);
     // Add third arc
     arcBounds.Location = new PointF(x, y + height - ry);
     _path.AddArc(arcBounds, 90, 90);
     // Add fourth line
     lineStart.X = x;
     lineStart.Y = Math.Max(y + height - ry, y + height * 0.5f);
     lineEnd.X = lineStart.X;
     lineEnd.Y = Math.Min(y + ry, y + height * 0.5f);
     _path.AddLine(lineStart, lineEnd);
     // Close
     _path.CloseFigure();
     return _path;
 }