반응형
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Viewbox>
<Canvas Width="280" Height="280" VerticalAlignment="Center">
<Ellipse Canvas.Left="20" Canvas.Top="20" Width="260" Height="260" Fill="LimeGreen" Stroke="Black"/>
<Ellipse Canvas.Left="70" Canvas.Top="70" Width="50" Height="50" Fill="Black" Stroke="Black"/>
<Ellipse Canvas.Left="170" Canvas.Top="70" Width="50" Height="50" Fill="Black" Stroke="Black" />
<Path Data="M 50,120 A 30,30 80 0 0 240, 120" Stroke="Red" StrokeThickness="3"/>
</Canvas>
</Viewbox>
</Window>
모든 쉐이프 객체들 (Ellipse, Line , Path, Polygon, Poliline, Rectangle) 은 공통적인 프로퍼티들을
공유한다, 다음은 가장일반적인적으로 사용하는 것이다
Stroke - 쉐이프의 윤관선을 어떻게 그릴지 지정한다.
StrokeThickness - 그릴 윤관선의 두께를 지정한다.
Fill - 쉐이프 내부를 어떻게 채울지 지정한다
이 모든 프로퍼티들의 좌표와 꼭짓점은 장치 독립적인 픽셀(device-independent pixcel)을 단위로 사용한다
Canvas는 자식 엘리먼트들이 절대 좌표(absolute positioning)을 사용할 수 있도록 해준다
Viewbox 때문에 창의 크기를 변경하면 자동으로 크기가 변경된다
- 출처 Programming .Net 3.5 by Jesse Liberty and Alex Horovitz. (소수 수정)
'.NET > WPF' 카테고리의 다른 글
WPF 기초 복합 컨트롤 (0) | 2009.07.17 |
---|---|
WPF 기초 의존 프로퍼티와 첨부 프로퍼티 애니메이션, 동시 실행 애니메이션 (0) | 2009.07.17 |
WPF 기초 엘리먼트 간의 포함 관계 Window.Resource 형태변형 (0) | 2009.07.16 |
WPF 기초 Resource, Linear Gradient , Style (0) | 2009.07.16 |
WPF 기초 StackPanel 사용과 <FlowDocumentReader> <FlowDocument> <Paragraph> <Paragraph.FontFamily> <Paragraph.FontSize> <Bold> <LineBreak /> (0) | 2009.07.15 |
WPF 기초 DockPanel 선언 순서가 중요하다 (0) | 2009.07.15 |
WPF 기초 <Grid.RowDefinitions> <RowDefinition> <Grid.ColumnDefinitions> <ColumnDefinition> (0) | 2009.07.15 |
WPF 에디터 (0) | 2009.07.13 |