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

■ 최소 실행 코드 사용하기

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


TestProject.zip


App.cs

 

 

using Windows.ApplicationModel.Activation;

using Windows.Foundation;

using Windows.Graphics.Display;

using Windows.UI;

using Windows.UI.ViewManagement;

using Windows.UI.Xaml;

using Windows.UI.Xaml.Controls;

using Windows.UI.Xaml.Media;

 

namespace TestProject

{

    /// <summary>

    ///

    /// </summary>

    public class App : Application

    {

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method

        ////////////////////////////////////////////////////////////////////////////////////////// Static

        //////////////////////////////////////////////////////////////////////////////// Private

 

        #region 프로그램 실행하기 - Main()

 

        /// <summary>

        /// 프로그램 실행하기

        /// </summary>

        private static void Main()

        {

            Application.Start((p) => new App());

        }

 

        #endregion

 

        ////////////////////////////////////////////////////////////////////////////////////////// Instance

        //////////////////////////////////////////////////////////////////////////////// Protected

 

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

 

        /// <summary>

        /// 시작시 처리하기

        /// </summary>

        /// <param name="e">이벤트 인자</param>

        protected override void OnLaunched(LaunchActivatedEventArgs e)

        {

            TextBlock textBlock = new TextBlock

            {

                HorizontalAlignment = HorizontalAlignment.Center,

                VerticalAlignment   = VerticalAlignment.Center,

                Foreground          = new SolidColorBrush(Colors.Red),

                FontFamily          = new FontFamily("Times New Roman"),

                FontSize            = 96,

                Text                = "Windows 10",

            };

 

            Window.Current.Content = textBlock;

 

            #region 윈도우 크기를 설정한다.

 

            double width  = 800d;

            double height = 600d;

 

            double dpi = (double)DisplayInformation.GetForCurrentView().LogicalDpi;

 

            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;

 

            Size windowSize = new Size(width * 96d / dpi, height * 96d / dpi);

 

            ApplicationView.PreferredLaunchViewSize = windowSize;

 

            Window.Current.Activate();

 

            ApplicationView.GetForCurrentView().TryResizeView(windowSize);

 

            #endregion

        }

 

        #endregion

    }

}

 

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

Posted by 사용자 icodebroker
TAG , ,

댓글을 달아 주세요