Exemple #1
0
        private void _InitializeWindowResizeBorderThickness()
        {
            Size frameSize = new Size(
                NativeMethodsShell.GetSystemMetrics(SM.CXSIZEFRAME),
                NativeMethodsShell.GetSystemMetrics(SM.CYSIZEFRAME));
            Size frameSizeInDips = DpiHelper.DeviceSizeToLogical(frameSize);

            WindowResizeBorderThickness = new Thickness(frameSizeInDips.Width, frameSizeInDips.Height, frameSizeInDips.Width, frameSizeInDips.Height);
        }
Exemple #2
0
        private void _InitializeWindowNonClientFrameThickness()
        {
            Size frameSize = new Size(
                NativeMethodsShell.GetSystemMetrics(SM.CXSIZEFRAME),
                NativeMethodsShell.GetSystemMetrics(SM.CYSIZEFRAME));
            Size   frameSizeInDips     = DpiHelper.DeviceSizeToLogical(frameSize);
            int    captionHeight       = NativeMethodsShell.GetSystemMetrics(SM.CYCAPTION);
            double captionHeightInDips = DpiHelper.DevicePixelsToLogical(new Point(0, captionHeight)).Y;

            WindowNonClientFrameThickness = new Thickness(frameSizeInDips.Width, frameSizeInDips.Height + captionHeightInDips, frameSizeInDips.Width, frameSizeInDips.Height);
        }
Exemple #3
0
        private void _LegacyInitializeCaptionButtonLocation()
        {
            // This calculation isn't quite right, but it's pretty close.
            // I expect this is good enough for the scenarios where this is expected to be used.
            int captionX = NativeMethodsShell.GetSystemMetrics(SM.CXSIZE);
            int captionY = NativeMethodsShell.GetSystemMetrics(SM.CYSIZE);

            int frameX = NativeMethodsShell.GetSystemMetrics(SM.CXSIZEFRAME) + NativeMethodsShell.GetSystemMetrics(SM.CXEDGE);
            int frameY = NativeMethodsShell.GetSystemMetrics(SM.CYSIZEFRAME) + NativeMethodsShell.GetSystemMetrics(SM.CYEDGE);

            Rect captionRect = new Rect(0, 0, captionX * 3, captionY);

            captionRect.Offset(-frameX - captionRect.Width, frameY);

            WindowCaptionButtonsLocation = captionRect;
        }
Exemple #4
0
        private void _InitializeCaptionHeight()
        {
            Point ptCaption = new Point(0, NativeMethodsShell.GetSystemMetrics(SM.CYCAPTION));

            WindowCaptionHeight = DpiHelper.DevicePixelsToLogical(ptCaption).Y;
        }
Exemple #5
0
 private void _InitializeSmallIconSize()
 {
     SmallIconSize = new Size(
         NativeMethodsShell.GetSystemMetrics(SM.CXSMICON),
         NativeMethodsShell.GetSystemMetrics(SM.CYSMICON));
 }