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

TestProject.zip
다운로드

▶ App.xaml

<Application
    x:Class="TestProject.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    RequestedTheme="Dark">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Common/StandardStyle.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

 

728x90

 

▶ App.xaml.cs

using System;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Graphics.Display;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace TestProject
{
    /// <summary>
    /// 앱
    /// </summary>
    sealed partial class App : Application
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - App()

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

            Suspending += Application_Suspending;
        }

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method
        ////////////////////////////////////////////////////////////////////////////////////////// Protected
        //////////////////////////////////////////////////////////////////////////////// Function

        #region 런치시 처리하기 - OnLaunched(e)

        /// <summary>
        /// 런치시 처리하기
        /// </summary>
        /// <param name="e">이벤트 인자</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            if(rootFrame == null)
            {
                rootFrame = new Frame();

                Window.Current.Content = rootFrame;
            }

            if(rootFrame.Content == null)
            {
                if(!rootFrame.Navigate(typeof(MainPage), e.Arguments))
                {
                    throw new Exception("초기 페이지 생성시 실패했습니다.");
                }
            }

            SetWindowSize(800, 600);

            Window.Current.Activate();
        }

        #endregion

        ////////////////////////////////////////////////////////////////////////////////////////// Private
        //////////////////////////////////////////////////////////////////////////////// Event

        #region 애플리케이션 실행 보류시 처리하기 - Application_Suspending(sender, e)

        /// <summary>
        /// 애플리케이션 실행 보류시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void Application_Suspending(object sender, SuspendingEventArgs e)
        {
            SuspendingDeferral suspendingDeferral = e.SuspendingOperation.GetDeferral();

            suspendingDeferral.Complete();
        }

        #endregion

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

        #region 윈도우 크기 설정하기 - SetWindowSize(width, height)

        /// <summary>
        /// 윈도우 크기 설정하기
        /// </summary>
        /// <param name="width">너비</param>
        /// <param name="height">높이</param>
        private void SetWindowSize(double width, double height)
        {
            float logicalDPI = DisplayInformation.GetForCurrentView().LogicalDpi;

            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;

            Size desiredSize = new Size((width * 96.0f / logicalDPI), (height * 96.0f / logicalDPI));

            ApplicationView.PreferredLaunchViewSize = desiredSize;
        }

        #endregion
    }
}

 

300x250

 

▶ 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"
    FontFamily="나눔고딕코딩"
    FontSize="16">
    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <TextBlock
            HorizontalAlignment="Center"
            VerticalAlignment="Center"
            Foreground="Yellow"
            FontSize="96"
            FontStyle="Italic"
            Text="Hello, World!" />
    </Grid>
</Page>

 

▶ MainPage.xaml.cs

using Windows.UI.Xaml.Controls;

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

        #region 생성자 - MainPage()

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

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

댓글을 달아 주세요