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

■ Line 엘리먼트 : StrokeStartLineCap/StrokeEndLineCap 속성 사용하기

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


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="Line 엘리먼트 : StrokeStartLineCap/StrokeEndLineCap 속성 사용하기"

    FontFamily="나눔고딕코딩"

    FontSize="16">

    <StackPanel Orientation="Horizontal">

        <StackPanel.Resources>

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

                <Setter Property="Width" Value="150" />

                <Setter Property="Margin" Value="10" />

            </Style>

            <Style x:Key="thin">

                <Setter Property="Line.X1"     Value="00"    />

                <Setter Property="Line.Y1"     Value="50"    />

                <Setter Property="Line.X2"     Value="100"   />

                <Setter Property="Line.Y2"     Value="50"    />

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

            </Style>

            <Style x:Key="thick" BasedOn="{StaticResource thin}">

                <Setter Property="Line.Stroke"          Value="LightGray" />

                <Setter Property="Line.StrokeThickness" Value="25"        />

            </Style>

        </StackPanel.Resources>

        <!-- PenLineCap.Flat -->

        <Canvas>

            <TextBlock Text="PenLineCap.Flat" />

            <Line

                Style="{StaticResource thick}"

                StrokeStartLineCap="Flat"

                StrokeEndLineCap="Flat" />

            <Line Style="{StaticResource thin}" />

        </Canvas>

        <!-- PenLineCap.Square -->

        <Canvas>

            <TextBlock Text="PenLineCap.Square" />

            <Line

                Style="{StaticResource thick}"

                StrokeStartLineCap="Square"

                StrokeEndLineCap="Square" />

            <Line Style="{StaticResource thin}" />

        </Canvas>

        <!-- PenLineCap.Round -->

        <Canvas>

            <TextBlock Text="PenLineCap.Round" />

            <Line

                Style="{StaticResource thick}"

                StrokeStartLineCap="Round"

                StrokeEndLineCap="Round" />

            <Line Style="{StaticResource thin}" />

        </Canvas>

        <!-- PenLineCap.Triangle -->

        <Canvas>

            <TextBlock Text="PenLineCap.Triangle" />

            <Line

                Style="{StaticResource thick}"

                StrokeStartLineCap="Triangle"

                StrokeEndLineCap="Triangle" />

            <Line Style="{StaticResource thin}" />

        </Canvas>

    </StackPanel>

</Window>

 

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

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요