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

TestProject.zip
다운로드

▶ MainPage.xaml

<Page x:Class="TestProject.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <!-- 중국어 (간체) -->
        <TextBlock
            HorizontalAlignment="Left"
            VerticalAlignment="Top"
            Text="你好,世界" />
        <!-- 우르두어 -->
        <TextBlock
            HorizontalAlignment="Center"
            VerticalAlignment="Top"
            Text="ہیلو دنیا،" />
        <!-- 일본어 -->
        <TextBlock
            HorizontalAlignment="Right"
            VerticalAlignment="Top"
            Text="こんにちは、世界中のみなさん" />
        <!-- 히브리어 -->
        <TextBlock
            HorizontalAlignment="Left"
            VerticalAlignment="Center"
            Text="שלום, עולם" />
        <!-- 에스페란토어 -->
        <TextBlock
            HorizontalAlignment="Center"
            VerticalAlignment="Center"
            Text="Saluton, mondo" />
        <!-- 아라비아어 -->
        <TextBlock
            HorizontalAlignment="Right"
            VerticalAlignment="Center"
            Text="مرحبا، العالم" />
        <!-- 한국어 -->
        <TextBlock
            HorizontalAlignment="Left"
            VerticalAlignment="Bottom"
            Text="안녕하세요, 전 세계" />
        <!-- 러시아어 -->
        <TextBlock
            HorizontalAlignment="Center"
            VerticalAlignment="Bottom"
            Text="Здравствуй, мир" />
        <!-- 힌디어 -->
        <TextBlock
            HorizontalAlignment="Right"
            VerticalAlignment="Bottom"
            Text="नमस्ते दुनिया है," />
    </Grid>
</Page>

 

728x90

 

▶ MainPage.xaml.cs

using Windows.Graphics.Display;
using Windows.UI.Xaml.Controls;

namespace TestProject
{
    /// <summary>
    /// 메인 페이지
    /// </summary>
    public sealed partial class MainPage : Page
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - MainPage()

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

            SetFontSize();

            DisplayInformation displayInformation = DisplayInformation.GetForCurrentView();

            displayInformation.OrientationChanged += DisplayInformation_OrientationChanged;
        }

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method
        ////////////////////////////////////////////////////////////////////////////////////////// Private
        //////////////////////////////////////////////////////////////////////////////// Event

        #region 디스플레이 정보 방향 변경시 처리하기 - DisplayInformation_OrientationChanged(sender, e)

        /// <summary>
        /// 디스플레이 정보 방향 변경시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void DisplayInformation_OrientationChanged(DisplayInformation sender, object e)
        {
            SetFontSize();
        }

        #endregion

        //////////////////////////////////////////////////////////////////////////////// Function

        #region 폰트 크기 설정하기 - SetFontSize()

        /// <summary>
        /// 폰트 크기 설정하기
        /// </summary>
        private void SetFontSize()
        {
            DisplayInformation displayInformation = DisplayInformation.GetForCurrentView();

            bool isLandscape = displayInformation.CurrentOrientation == DisplayOrientations.Landscape ||
                               displayInformation.CurrentOrientation == DisplayOrientations.LandscapeFlipped;

            FontSize = isLandscape ? 20 : 12;
        }

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

댓글을 달아 주세요