Dreamine.UI.Wpf.Equipment 1.0.1
Dreamine.UI.Wpf.Equipment 사용자 인터페이스 기능과 구성 요소를 제공합니다.
로딩중...
검색중...
일치하는것 없음
ShiftWindowOntoScreenHelper.cs
이 파일의 문서화 페이지로 가기
1using System.Windows;
2
4
13public static class ShiftWindowOntoScreenHelper
14{
15
48 public static void ShiftWindowOntoScreen(Window window, Rect waDip)
49 {
50 double width = double.IsNaN(window.Width) || window.Width == 0 ? window.ActualWidth : window.Width;
51 double height = double.IsNaN(window.Height) || window.Height == 0 ? window.ActualHeight : window.Height;
52
53 double left = window.Left;
54 double top = window.Top;
55
56 if (left + width > waDip.Right) left = waDip.Right - width;
57 if (left < waDip.Left) left = waDip.Left;
58 if (top + height > waDip.Bottom) top = waDip.Bottom - height;
59 if (top < waDip.Top) top = waDip.Top;
60
61 window.Left = left;
62 window.Top = top;
63 }
64}