今回は、キャンバスへ追加したオブジェクトの配置について説明したいと思います。
キャンバスへ追加可能なオブジェクトは、Canvas.LeftおよびCanvas.Topで、配置位置を指定することが可能です。
Silverlightの座標系は、左上隅を起点(0,0)としており、左から右へ向かってXの値が増加、上から下へ向かってYの値が増加します。
では、実際にCanvas.LeftとCanvas.Topを使用して、円を配置してみましょう。
<Canvas xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Ellipse Height="100" Width="100" Canvas.Left="50" Canvas.Top="50" Stroke="Black" StrokeThickness="3" Fill="Blue" /> </Canvas>
上記は幅と高さがともに100の円を、キャンバスの左から50、上から50の位置に配置します。
このように、オブジェクトの配置位置はCanvas.LeftおよびCanvas.Topで指定します。
実行結果はこちら。
サンプルは、こちらからダウンロードできます。
Theme design by Jelle Druyts
Pick a theme: BlogXP business calmBlue Candid Blue dasBlog dasblogger DirectionalRedux Discreet Blog Blue Elegante essence Just Html MadsSimple Mobile Mono Movable Radio Blue Movable Radio Heat nautica022 orangeCream Portal Project84 Project84Grass Slate Sound Waves Tricoleur useit.com Voidclass2 BlogXP business calmBlue Candid Blue dasBlog dasblogger DirectionalRedux Discreet Blog Blue Elegante essence Just Html MadsSimple Mobile Mono Movable Radio Blue Movable Radio Heat nautica022 orangeCream Portal Project84 Project84Grass Slate Sound Waves Tricoleur useit.com Voidclass2
Powered by: newtelligence dasBlog 2.0.7226.0
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2009, HIRO
E-mail