Canvas (도화지 같은 역활을 하는 기능을 의미) |
CanvasClip 사용 예제 Stroke, StrokeThickness 속성 사용 <UserControl x:Class="RiaCanvasClip.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Canvas x:Name="redCanvas" Background="White" Width="200" Height="200"> <Rectangle Canvas.Left="0" Canvas.Top="0" Fill="Red" Width="50" Height="50"> </Rectangle> <Rectangle Canvas.Left="20" Canvas.Top="20" Fill="Green" Width="50" Height="50"> </Rectangle> <Rectangle Canvas.Left="40" Canvas.Top="40" Fill="Blue" Width="50" Height="50"> </Rectangle> </Canvas> </UserControl> |
Canvas 에서 Z-INDEX 적용 <UserControl x:Class="RiaCanvasClip.FrmCanvasZIndex" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Grid x:Name="LayoutRoot" Background="White"> <Canvas x:Name="redCanvas" Background="White" Width="200" Height="200"> <Rectangle Canvas.Left="0" Canvas.Top="0" Fill="Red" Width="50" Height="50" Canvas.ZIndex="2"> </Rectangle> <Rectangle Canvas.Left="20" Canvas.Top="20" Fill="Green" Width="50" Height="50" Canvas.ZIndex="1"> </Rectangle> <Rectangle Canvas.Left="40" Canvas.Top="40" Fill="Blue" Width="50" Height="50" Canvas.ZIndex="0"> </Rectangle> </Canvas> </Grid> </UserControl> |
FrmCanvasLayout 사용 방법) Size.. (Width, Height) Canvas 안에 도형을 생성 할때 Size 속성을 사용하여 크게나 작게나 Canvas 안에 추가 가능하다. <UserControl x:Class="RiaCanvasClip.FrmCanvasLayout" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Grid x:Name="LayoutRoot" Background="White"> <Canvas Width="100" Height="100" Background="Blue"> <Ellipse Width="50" Height="50" Fill="Red"></Ellipse> </Canvas> </Grid> </UserControl> |
CanvasLayout (Canvas 실버라이트 영역 HTML 영역) 분리 <head> <title>RiaCanvasClip</title> <style type="text/css"> html, body { height: 100%; overflow: auto; } body { padding: 0; margin: 0; } #silverlightControlHost { height: 300px; width:400px; text-align:center; } |
'.Net Project > SilverLight 3.0' 카테고리의 다른 글
42장) ScrollViewer 컨트롤 (0) | 2009.12.01 |
---|---|
41장) ToolTip 컨트롤 (0) | 2009.12.01 |
39장) RadioButton 컨트롤 (0) | 2009.11.27 |
38장) CheckBox 컨트롤(IsThreeStater, IsThreeState) (0) | 2009.11.27 |
37장) HyperLink Button 컨트롤(_blank, _parent, Window Name) (0) | 2009.11.27 |