سوال در مورد رسم نیم دایره path در canvas
من با کد زیر می خوام یک نیم دایره در canvas رسم کنم ولی نمیشه به نظر شما ایراد ان کجاست ممنون
public void arcdraw(double heigth, double width, System.Windows.Thickness tn)
{
Color c = new Color();
c.A = 255;
c.B = 0;
c.G = 0;
c.R = 0;
Path pat = new Path();
pat.Height = heigth;//50
pat.Width = width;//50
pat.Stroke = new SolidColorBrush(c);
pat.Margin = tn;
pat.StrokeThickness = 0.4;
cannemodar.Children.Add(pat);
}
tn.left=50,tn.top=50
نقل قول: سوال در مورد رسم نیم دایره path در canvas
اطلاعات شما برای کشیدن Path کم می باشد. path از کجا شروه می شود. تا کدام نقطه چه چیزی می کشد و ...
این متد را نگاه کنید:
Path createPath(ObservableCollection<Point> rawData)
{
Path FinalPath = newPath();
PathGeometry FinalPathGeometry = newPathGeometry();
PathFigure PrimaryFigure = newPathFigure();
//if you want the path to be a shape, you want to close the PathFigure
// that makes up the Path. If you want it to simply by a line, set
// PrimaryFigure.IsClosed = false;
PrimaryFigure.IsClosed = true;
PrimaryFigure.StartPoint = rawData[0];
PathSegmentCollection LineSegmentCollection = newPathSegmentCollection();
for (int i = 1; i < rawData.Count; i++)
{
LineSegment newSegment = newLineSegment();
newSegment.Point = rawData[i];
LineSegmentCollection.Add(newSegment);
}
PrimaryFigure.Segments = LineSegmentCollection;
FinalPathGeometry.Figures.Add(PrimaryFigure);
FinalPath.Data = FinalPathGeometry;
return FinalPath;
}