XAMLによる描画~Polyline(折れ線)
折れ線を描くには<Polyline>を使います。始点、線を折る位置、終点をPoints属性にXY座標を半角スペースで区切って次のように指定します。
Points="X1,Y1 X2,Y2 X3,Y3……"
サンプルは次のとおりです。
http://www.makoto3.net/xaml/silverlight0032/index.html
ソースは次のとおりです。
【myxaml.xaml】
<Canvas
xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Polyline Points="0,10 30,50 60,10 90,50 120,10 150,50 180,10 210,50 240,10 270,50" Stroke="gold" StrokeThickness="5"/>
<Polyline Points="0,100 100,150 200,100 300,150"
Stroke="red" StrokeThickness="20"/>
<Polyline Points="10,150 10,200 50,200 50,150 100,150 100,200 150,200 150,150 200,150 250,200" Stroke="blue" StrokeThickness="15" Canvas.ZIndex="-1" />
<Polyline Points="10,250 250,10 250,300 50,50 280,50 50 280" Stroke="lime" StrokeThickness="30" Opacity="0.3" />
</Canvas>
サンプルで使用してある属性は次のとおりです。
|
Points |
始点、折れ線の折る位置、終点をX1,Y1 X2,Y2 X3,Y3……の形式で指定する。 |
|
Stroke |
線の色 |
|
StrokeThickness |
線の太さ |
|
Opacity |
透明度(0.0~1.0) |
|
Canvas.ZIndex |
重なり順(マイナス値だと下、プラス値だと上) |
このページは
xfy Blog Editor
を利用して作成されました。










コメント