예제 #1
0
 /// <summary>
 /// Returns a value indicating whether two specified instances of WindowBounds represent the same value.
 /// </summary>
 /// <param name="value">An object to compare to this instance.</param>
 /// <returns><see langword="true" /> if <paramref name="value" /> is equal to this instance; otherwise, <see langword="false" />.</returns>
 public bool Equals(WindowBounds value)
 {
     return(value.Left == Left &&
            value.Right == Right &&
            value.Top == Top &&
            value.Bottom == Bottom);
 }
예제 #2
0
 /// <summary>
 /// Returns a value indicating whether this instance and a specified <see cref="T:System.Object" /> represent the same type and value.
 /// </summary>
 /// <param name="obj">The object to compare with this instance.</param>
 /// <returns><see langword="true" /> if <paramref name="obj" /> is a WindowBounds and equal to this instance; otherwise, <see langword="false" />.</returns>
 public override bool Equals(object obj)
 {
     if (obj is WindowBounds)
     {
         WindowBounds value = (WindowBounds)obj;
         return(value.Left == Left &&
                value.Right == Right &&
                value.Top == Top &&
                value.Bottom == Bottom);
     }
     else
     {
         return(false);
     }
 }
예제 #3
0
        /// <summary>
        /// Returns the boundaries of a window.
        /// </summary>
        /// <param name="hwnd">A IntPtr representing the handle of a window.</param>
        /// <param name="bounds">A WindowBounds structure representing the boundaries of a window.</param>
        /// <returns></returns>
        public static bool GetWindowBounds(IntPtr hwnd, out WindowBounds bounds)
        {
            NativeRect rect;

            if (User32.GetWindowRect(hwnd, out rect))
            {
                bounds = new WindowBounds()
                {
                    Left   = rect.Left,
                    Top    = rect.Top,
                    Right  = rect.Right,
                    Bottom = rect.Bottom
                };

                return(true);
            }
            else
            {
                bounds = new WindowBounds();

                return(false);
            }
        }
예제 #4
0
 /// <summary>
 /// Returns a value indicating whether two specified instances of WindowBounds represent the same value.
 /// </summary>
 /// <param name="left">The first object to compare.</param>
 /// <param name="right">The second object to compare.</param>
 /// <returns> <see langword="true" /> if <paramref name="left" /> and <paramref name="right" /> are equal; otherwise, <see langword="false" />.</returns>
 public static bool Equals(WindowBounds left, WindowBounds right)
 {
     return(left.Equals(right));
 }