첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

■ DrawingImage 엘리먼트에서 DrawingGroup 객체를 사용해 이미지를 만드는 방법을 보여준다.

TestProject.zip
다운로드

▶ MainWindow.xaml

<Window x:Class="TestProject.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Width="800"
    Height="600"
    Title="DrawingImage 엘리먼트 : DrawingGroup 객체를 사용해 이미지 만들기"
    FontFamily="나눔고딕코딩"
    FontSize="16">
    <Grid>
        <Image Stretch="None">
            <Image.Source>
                <DrawingImage>
                    <DrawingImage.Drawing>
                        <DrawingGroup>
                            <ImageDrawing
                                Rect="0 50 200 250"
                                ImageSource="IMAGE/sample.jpg" />
                            <GeometryDrawing>
                                <GeometryDrawing.Pen>
                                    <Pen
                                        Brush="RoyalBlue"
                                        Thickness="5" />
                                </GeometryDrawing.Pen>
                                <GeometryDrawing.Geometry>
                                    <RectangleGeometry Rect="2.5 52.5 195 245" />
                                </GeometryDrawing.Geometry>
                            </GeometryDrawing>
                            <GeometryDrawing>
                                <GeometryDrawing.Pen>
                                    <Pen
                                        Brush="Blue"
                                        Thickness="5" />
                                </GeometryDrawing.Pen>
                                <GeometryDrawing.Geometry>
                                    <RectangleGeometry Rect="0 50 200 250" />
                                </GeometryDrawing.Geometry>
                            </GeometryDrawing>
                            <GeometryDrawing Geometry="M 0 50 L 100 0 L 200 50" >
                                <GeometryDrawing.Pen>
                                    <Pen
                                        Brush="Blue"
                                        Thickness="5" />
                                </GeometryDrawing.Pen>
                            </GeometryDrawing>
                        </DrawingGroup>
                    </DrawingImage.Drawing>
                </DrawingImage>
            </Image.Source>
        </Image>
    </Grid>
</Window>
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요