我正在嘗試爲我的WPF添加BezierSegment
到我的畫布。我發現了一個不正確的投編譯時錯誤:將(BezierSegment添加到a)Canvas路徑
參數1:無法從「System.Windows.Media.PathGeometry」轉換爲「System.Windows.UIElement」
這是我到目前爲止...
//bezier curve it
BezierSegment curve = new BezierSegment(startPoint, endPoint,controlPoint,false);
// Set up the Path to insert the segments
PathGeometry path = new PathGeometry();
PathFigure pathFigure = new PathFigure();
pathFigure.StartPoint = hs.LeStartingPoint;
pathFigure.IsClosed = true;
path.Figures.Add(pathFigure);
pathFigure.Segments.Add(curve);
System.Windows.Shapes.Path p = new Path();
p.Data = path;
this.mainWindow.MyCanvas.Children.Add(path);
任何幫助將不勝感激!
+1,打我,並很好的佈局= d – Chris
@克里斯:加上你嘗試:)。 –
D'oh,謝謝你們兩位! – Ace