예제 #1
0
 /// <summary>
 /// Get the window size.
 /// </summary>
 /// <returns>The size.</returns>
 public Vector2 GetSize()
 {
     if (!IsActive)
     {
         return(Vector2.zero);
     }
     WinApi.RECT rect = new WinApi.RECT();
     WinApi.GetWindowRect(hWnd, out rect);
     return(new Vector2(rect.right - rect.left, rect.bottom - rect.top));
 }
예제 #2
0
 /// <summary>
 /// Get the window position.
 /// </summary>
 /// <returns>The position.</returns>
 public Vector2 GetPosition()
 {
     if (!IsActive)
     {
         return(Vector2.zero);
     }
     WinApi.RECT rect = new WinApi.RECT();
     WinApi.GetWindowRect(hWnd, out rect);
     return(new Vector2(rect.left, rect.top));
 }
예제 #3
0
        /// <summary>
        /// Stores the size and position of the window.
        /// </summary>
        private void StoreWindowSize()
        {
            // 今の状態を記憶
            if (IsActive && !WinApi.IsZoomed(hWnd) && !WinApi.IsIconic(hWnd))
            {
                WinApi.RECT rect = new WinApi.RECT();

                // ウィンドウ位置とサイズ
                WinApi.GetWindowRect(hWnd, out rect);
                this.OriginalWindowPosition = new Vector2(rect.left, rect.top);
                this.OriginalWindowSize     = new Vector2(rect.right - rect.left, rect.bottom - rect.top);
            }
        }