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

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="TranslateTransform 엘리먼트 : X/Y 속성 사용하기"
    FontFamily="나눔고딕코딩"
    FontSize="16">
    <StackPanel>
        <Label Content="X" />
        <ScrollBar Name="xScrollBar"
            Orientation="Horizontal"
            Minimum="-300"
            Maximum="1000" />
        <TextBlock
            HorizontalAlignment="Center"
            Margin="10"
            Text="{Binding ElementName=xScrollBar, Path=Value}" />
        <Label Content="Y" />
        <ScrollBar Name="yScrollBar"
            Orientation="Horizontal"
            Minimum="-300"
            Maximum="1000" />
        <TextBlock
            HorizontalAlignment="Center"
            Margin="10"
        Text="{Binding ElementName=yScrollBar, Path=Value}" />
        <Canvas>
            <Line
                X1="100"
                Y1="0"
                X2="100"
                Y2="1000"
                Stroke="Black" />
            <Line
                X1="0"
                Y1="100"
                X2="1000"
                Y2="100"
                Stroke="Black" />
            <Button Canvas.Left="100" Canvas.Top="100"
                Padding="10"
                Content="Button">
                <Button.RenderTransform>
                    <TranslateTransform
                        X="{Binding ElementName=xScrollBar, Path=Value}"
                        Y="{Binding ElementName=yScrollBar, Path=Value}" />
                </Button.RenderTransform>
            </Button>
        </Canvas>
    </StackPanel>
</Window>

 

728x90

 

▶ MainWindow.xaml.cs

using System.Windows;

namespace TestProject
{
    /// <summary>
    /// 메인 윈도우
    /// </summary>
    public partial class MainWindow : Window
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - MainWindow()

        /// <summary>
        /// 생성자
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();
        }

        #endregion
    }
}
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요