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

■ DrawingGroup 엘리먼트에서 GuidelineSet 객체를 설정해 드로잉을 만드는 방법을 보여준다.

TestProject.zip
0.01MB

▶ 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"
    xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
    Width="800"
    Height="600"
    Title="TestProject"
    FontFamily="나눔고딕코딩"
    FontSize="16">
    <Border
        HorizontalAlignment="Center"
        VerticalAlignment="Center"
        BorderThickness="1"
        BorderBrush="Gray">
        <Border.Background>
            <DrawingBrush
                ViewportUnits="Absolute"
                Viewport="0 0 10 10"
                TileMode="Tile"
                PresentationOptions:Freeze="True">
                <DrawingBrush.Drawing>
                    <DrawingGroup>
                        <GeometryDrawing Brush="White">
                            <GeometryDrawing.Geometry>
                                <RectangleGeometry Rect="0 0 1 1" />
                            </GeometryDrawing.Geometry>
                        </GeometryDrawing>
                        <GeometryDrawing
                            Geometry="M 0 0 L 1 0 1 0.1 0 0.1 Z"
                            Brush="#ccccff" />
                        <GeometryDrawing
                            Geometry="M 0 0 L 0 1 0.1 1 0.1 0 Z"
                            Brush="#ccccff" />
                    </DrawingGroup>
                </DrawingBrush.Drawing>
            </DrawingBrush>
        </Border.Background>
        <StackPanel
            Margin="20"
            Orientation="Horizontal">
            <Image
                Margin="10"
                Stretch="None">
                <Image.Source>
                    <DrawingImage PresentationOptions:Freeze="True">
                        <DrawingImage.Drawing>
                            <DrawingGroup>
                                <GeometryDrawing Brush="Black">
                                    <GeometryDrawing.Geometry>
                                        <RectangleGeometry Rect="0 20 30 80" />
                                    </GeometryDrawing.Geometry>
                                </GeometryDrawing>
                                <GeometryDrawing Brush="White">
                                    <GeometryDrawing.Geometry>
                                        <GeometryGroup>
                                            <RectangleGeometry Rect="5.5 25 20 20" />
                                            <RectangleGeometry Rect="5.5 50 20 20" />
                                            <RectangleGeometry Rect="5.5 75 20 20" />
                                        </GeometryGroup>
                                    </GeometryDrawing.Geometry>
                                </GeometryDrawing>
                            </DrawingGroup>
                        </DrawingImage.Drawing>
                    </DrawingImage>
                </Image.Source>
            </Image>
            <Image
                Stretch="None"
                Margin="50 10 10 10">
                <Image.Source>
                    <DrawingImage PresentationOptions:Freeze="True">
                        <DrawingImage.Drawing>
                            <DrawingGroup>
                                <GeometryDrawing Brush="Black">
                                    <GeometryDrawing.Geometry>
                                        <RectangleGeometry Rect="0 20 30 80" />
                                    </GeometryDrawing.Geometry>
                                </GeometryDrawing>
                                <GeometryDrawing Brush="White">
                                    <GeometryDrawing.Geometry>
                                        <GeometryGroup>
                                            <RectangleGeometry Rect="5.5 25 20 20" />
                                            <RectangleGeometry Rect="5.5 50 20 20" />
                                            <RectangleGeometry Rect="5.5 75 20 20" />
                                        </GeometryGroup>
                                    </GeometryDrawing.Geometry>
                                </GeometryDrawing>
                                <DrawingGroup.GuidelineSet>
                                    <GuidelineSet
                                        GuidelinesX="5.5 25.5"
                                        GuidelinesY="25 50 75" />
                                </DrawingGroup.GuidelineSet>
                            </DrawingGroup>
                        </DrawingImage.Drawing>
                    </DrawingImage>
                </Image.Source>
            </Image>
        </StackPanel>
    </Border>
</Window>
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요