看看繪製貝塞爾曲線(MSDN Link),瞭解不同的幾何類型(MSDN Link)
下面是一個代碼示例,讓你開始,將產生如下圖:
<Canvas x:Name="LayoutRoot" Background="White">
<Path Stroke="Blue" StrokeThickness="2" >
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure StartPoint="50,50">
<PathFigure.Segments>
<PathSegmentCollection>
<BezierSegment
Point1="50,20"
Point2="120,170"
Point3="350,150"
/>
</PathSegmentCollection>
</PathFigure.Segments>
</PathFigure>
</PathFigureCollection>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
<Path Fill="Gold" Stroke="Black" StrokeThickness="1">
<Path.Data>
<EllipseGeometry Center="50,50" RadiusX="20" RadiusY="20" />
</Path.Data>
</Path>
<Path Fill="Gold" Stroke="Black" StrokeThickness="1">
<Path.Data>
<EllipseGeometry Center="350,150" RadiusX="20" RadiusY="20" />
</Path.Data>
</Path>
</Canvas>
有沒有辦法用簡單的「Line」類來做到這一點? – vondip 2011-04-05 02:56:09
一條線只能是一條直線。您在這裏沒有太多選擇。貝塞爾曲線絕對是你最好的,也是唯一的選擇。 – 2011-04-05 03:08:02
我明白了,你知道任何開源框架,它們很容易支持它們之間的定位點和繪圖嗎? – vondip 2011-04-05 03:13:50