<Image /> 컨트롤
.NET프로그래밍/Silverlight 3.0 2009. 11. 26. 10:04 |
--> 아래그림과 같이 '솔루션 탐색기'에서 "images"폴더를 만들고, "images"폴더안에 이미지파일인 "img.jpg"를 추가한다.
-------------------------------------------------------------------------------------
[MainPage.xaml]
<UserControl x:Class="RiaImage.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">
<Grid x:Name="LayoutRoot" Background="Silver" Height="300" Width="400">
<Image Source="./images/img.jpg" Margin="30"
Stretch="UniformToFill"></Image>
</Grid>
</UserControl>
-------------------------------------------------------------------------------------
[실행결과]
-------------------------------------------------------------------------------------
** 참고 **
* DLL 파일에 이미지 포함시키는 방법
- 빌드시 이미지 속성에서 "리소스"로 설정
- <Images Source="/DLL명;component/이미지경로" />
샘플예제
<Image Source="/RiaImage;component/images/img.jpg"
[MainPage.xaml]
<UserControl x:Class="RiaImage.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">
<Grid x:Name="LayoutRoot" Background="Silver" Height="300" Width="400">
<Image Source="/RiaImage;component/images/img.jpg" Margin="30"
Stretch="UniformToFill"></Image>
</Grid>
</UserControl>
-------------------------------------------------------------------------------------
[실행결과]
'.NET프로그래밍 > Silverlight 3.0' 카테고리의 다른 글
<LineGeometry> (0) | 2009.11.26 |
---|---|
<MediaElement> (0) | 2009.11.26 |
도형(Shape) - <Path> : 모든 모양 (0) | 2009.11.25 |
도형(Shape) - <Polygon> : 다각형(닫혀있는 모양) (0) | 2009.11.25 |
도형(Shape) - <Polyline> : 선(열려있는 모양) (0) | 2009.11.25 |