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

■ ImageBrush 엘리먼트 사용하기

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

 

<Page

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Page.Resources>

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

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

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

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

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

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

        </Style>

    </Page.Resources>

    <StackPanel

        Margin="10 10 10 10"

        Orientation="Horizontal"

        VerticalAlignment="Top">

        <Rectangle>

            <Rectangle.Fill>

                <ImageBrush ImageSource="pinkcherries.jpg" />

            </Rectangle.Fill>

        </Rectangle>

        <Rectangle>

            <Rectangle.Fill>

                <ImageBrush

                    Stretch="None"

                    ImageSource="pinkcherries.jpg" />

            </Rectangle.Fill>

        </Rectangle>

        <Rectangle>

            <Rectangle.Fill>

                <ImageBrush

                    TileMode="Tile"

                    ViewportUnits="Absolute"

                    Viewport="0 0 25 25"

                    ImageSource="pinkcherries.jpg" />

            </Rectangle.Fill>

        </Rectangle>

        <Rectangle>

            <Rectangle.Fill>

                <ImageBrush

                    TileMode="Tile"

                    ViewportUnits="Absolute"

                    Viewport="0 0 10 10"

                    ImageSource="pinkcherries.jpg" />

            </Rectangle.Fill>

        </Rectangle>

    </StackPanel>

</Page>

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

Posted by 사용자 icodebroker

댓글을 달아 주세요