첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
유용한 소스 코드가 있으면 icodebroker@naver.com으로 보내주시면 감사합니다.
블로그 자료는 자유롭게 사용하세요.

■ Shape 엘리먼트 : 얼굴 그리기

------------------------------------------------------------------------------------------------------------------------


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="Shape 엘리먼트 : 얼굴 그리기"

    FontFamily="나눔고딕코딩"

    FontSize="16">

    <Window.Resources>

        <Style TargetType="{x:Type Line}">

            <Setter Property="Stroke"          Value="Black" />

            <Setter Property="StrokeThickness" Value="2"     />

        </Style>

    </Window.Resources>

    <Canvas>

        <!-- 머리 -->

        <Ellipse Canvas.Left="96" Canvas.Top="96"

            Width="144"

            Height="240"

            Stroke="Black"

            Fill="PeachPuff" />

        <!-- 귀 -->

        <Polygon

            Stroke="Black"

            Fill="SandyBrown"

            Points="100 192, 84 168, 84 240, 100 216" />

        <Polygon

            Stroke="Black"

            Fill="SandyBrown"

            Points="236 192, 252 168, 252 240, 236 216" />

        <!-- 눈 -->

        <Ellipse Canvas.Left="120" Canvas.Top="168"

            Width="36"

            Height="36"

            Stroke="Black"

            Fill="White" />

        <Ellipse Canvas.Left="180" Canvas.Top="168"

            Width="36"

            Height="36"

            Stroke="Black"

            Fill="White" />

        <!-- 눈동자 -->

        <Ellipse Canvas.Left="129" Canvas.Top="177"

            Width="18"

            Height="18"

            Stroke="Black"

            Fill="Brown" />

        <Ellipse Canvas.Left="189" Canvas.Top="177"

            Width="18"

            Height="18"

            Stroke="Black"

            Fill="Brown" />

        <!-- 코 -->

        <Polygon

            Stroke="Black"

            Fill="Pink"

            Points="168 192, 158 240, 178 240" />

        <!-- 입 -->

        <Ellipse Canvas.Left="120" Canvas.Top="260"

            Width="96"

            Height="24"

            Stroke="Red"

            StrokeThickness="8"

            Fill="White" />

        <!-- 수염 -->

        <Line X1="120" Y1="288" X2="120" Y2="336" />

        <Line X1="126" Y1="290" X2="126" Y2="338" />

        <Line X1="132" Y1="292" X2="132" Y2="340" />

        <Line X1="138" Y1="294" X2="138" Y2="342" />

        <Line X1="144" Y1="296" X2="144" Y2="344" />

        <Line X1="150" Y1="297" X2="150" Y2="345" />

        <Line X1="156" Y1="298" X2="156" Y2="346" />

        <Line X1="162" Y1="299" X2="162" Y2="347" />

        <Line X1="168" Y1="300" X2="168" Y2="348" />

        <Line X1="174" Y1="299" X2="174" Y2="347" />

        <Line X1="180" Y1="298" X2="180" Y2="346" />

        <Line X1="186" Y1="297" X2="186" Y2="345" />

        <Line X1="192" Y1="296" X2="192" Y2="344" />

        <Line X1="198" Y1="294" X2="198" Y2="342" />

        <Line X1="204" Y1="292" X2="204" Y2="340" />

        <Line X1="210" Y1="290" X2="210" Y2="338" />

        <Line X1="216" Y1="288" X2="216" Y2="336" />

    </Canvas>

</Window>

 

------------------------------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker

댓글을 달아 주세요