Exemplo n.º 1
0
        private static void SetStatusBar()
        {
            /* mobile 设置状态栏 */
            if (SystemInfoHelper.GetDeviceFormFactorType() == DeviceFormFactorType.Phone)
            {
                StatusBar statusBar = StatusBar.GetForCurrentView();
                statusBar.BackgroundOpacity = 0;
                statusBar.ForegroundColor   = Colors.White;
                ApplicationView.GetForCurrentView()
                .SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
            }
            /* 桌面设置 */
            var view = ApplicationView.GetForCurrentView();

            view.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
            view.TitleBar.InactiveBackgroundColor       = Colors.Transparent;
            view.TitleBar.BackgroundColor = Colors.Transparent;
            // button
            view.TitleBar.ButtonInactiveForegroundColor = Colors.Gray;
            view.TitleBar.ButtonForegroundColor         = Colors.White;
            //view.TitleBar.ButtonHoverForegroundColor = Colors.Black;
            //view.TitleBar.ButtonPressedForegroundColor = Colors.Black;
            view.TitleBar.ButtonBackgroundColor = Colors.Transparent;
            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
        }
Exemplo n.º 2
0
        void PositionImage()
        {
            var deviceType = SystemInfoHelper.GetDeviceFormFactorType();

            // desktop
            if (deviceType == DeviceFormFactorType.Desktop)
            {
                extendedSplashImage.SetValue(Canvas.LeftProperty, splashImageRect.X);
                extendedSplashImage.SetValue(Canvas.TopProperty, splashImageRect.Y);
                extendedSplashImage.Height = splashImageRect.Height;
                extendedSplashImage.Width  = splashImageRect.Width;
            }
            else if (deviceType == DeviceFormFactorType.Tablet)
            {
                extendedSplashImage.SetValue(Canvas.LeftProperty, splashImageRect.X);
                extendedSplashImage.SetValue(Canvas.TopProperty, splashImageRect.Y);
                extendedSplashImage.Height = splashImageRect.Height;
                extendedSplashImage.Width  = splashImageRect.Width;
            }
            // mobile
            else if (deviceType == DeviceFormFactorType.Phone)
            {
                // 获取一个值,该值表示每个视图(布局)像素的原始(物理)像素数。
                double density = Windows.Graphics.Display.DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;

                extendedSplashImage.SetValue(Canvas.LeftProperty, splashImageRect.X / density);
                extendedSplashImage.SetValue(Canvas.TopProperty, splashImageRect.Y / density);
                extendedSplashImage.Height = splashImageRect.Height / density;
                extendedSplashImage.Width  = splashImageRect.Width / density;
            }
            // xbox等没试过,编不出来
            else
            {
                extendedSplashImage.SetValue(Canvas.LeftProperty, splashImageRect.X);
                extendedSplashImage.SetValue(Canvas.TopProperty, splashImageRect.Y);
                extendedSplashImage.Height = splashImageRect.Height;
                extendedSplashImage.Width  = splashImageRect.Width;
            }
        }