티스토리 뷰

C#/WPF

WPF tutorial - The Canvas

광그로 2017. 6. 22. 17:01

http://www.wpf-tutorial.com/panels/canvas/


쉽게 말해 Canvas는 상대적이 아닌 절대적으로 패치되어진다고 생각하면 됩니다.


1
2
3
4
5
6
<Canvas>
        <Button Canvas.Left="10">Top left</Button>
        <Button Canvas.Right="10">Top right</Button>
        <Button Canvas.Left="40" Canvas.Bottom="60">Bottom left</Button>
        <Button Canvas.Right="60" Canvas.Bottom="10">Bottom right</Button>
    </Canvas>
cs



Z-index


Z-index를 사용하여 컨트롤의 순서를 결정할 수 있습니다.

1
2
3
4
5
6
<Canvas>
        <Ellipse Fill="Gainsboro" Canvas.Left="25" Canvas.Top="25" Width="200" Height="200" />
        <Rectangle Fill="LightBlue" Canvas.Left="25" Canvas.Top="25" Width="50" Height="50" />
        <Rectangle Fill="LightCoral" Canvas.Left="50" Canvas.Top="50" Width="50" Height="50" />
        <Rectangle Fill="LightCyan" Canvas.Left="75" Canvas.Top="75" Width="50" Height="50" />
    </Canvas>
cs


1
2
3
4
5
6
 <Canvas>
        <Ellipse Panel.ZIndex="2" Fill="Gainsboro" Canvas.Left="25" Canvas.Top="25" Width="200" Height="200" />
        <Rectangle Panel.ZIndex="3" Fill="LightBlue" Canvas.Left="25" Canvas.Top="25" Width="50" Height="50" />
        <Rectangle Panel.ZIndex="2" Fill="LightCoral" Canvas.Left="50" Canvas.Top="50" Width="50" Height="50" />
        <Rectangle Panel.ZIndex="4" Fill="LightCyan" Canvas.Left="75" Canvas.Top="75" Width="50" Height="50" />
    </Canvas>
cs


    


                                                                                                            (ZIndex 적용)


'C# > WPF' 카테고리의 다른 글

WPF tutorial - The StackPanel  (0) 2017.06.22
WPF tutorial -The WrapPanel  (0) 2017.06.22
WPF tutorial - Introduction to WPF panels  (0) 2017.06.22
WPF tutorial - WPF text rendering  (0) 2017.06.22
WPF tutorial - Control ToolTips  (0) 2017.06.22
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
글 보관함