Files
cefsharp/CefSharp.Wpf/Internals/RectStruct.cs
T
amaitland a10a5ef897 WPF - ChromiumWebBrowser.GetScreenInfo provide Rect and AvailableRect
Get monitor info based on handle (hwnd).

It's unclear if the coordinates need to be dpi scaled, revisit later if they do
2018-10-29 20:13:02 +10:00

49 lines
1.8 KiB
C#

// Copyright © 2018 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System.Runtime.InteropServices;
using CefSharp.Structs;
namespace CefSharp.Wpf.Internals
{
/// <summary>
/// The RECT structure defines the coordinates of the upper-left and lower-right corners of a rectangle.
/// </summary>
/// <see cref="http://msdn.microsoft.com/en-us/library/dd162897%28VS.85%29.aspx"/>
/// <remarks>
/// By convention, the right and bottom edges of the rectangle are normally considered exclusive.
/// In other words, the pixel whose coordinates are ( right, bottom ) lies immediately outside of the the rectangle.
/// For example, when RECT is passed to the FillRect function, the rectangle is filled up to, but not including,
/// the right column and bottom row of pixels. This structure is identical to the RECTL structure.
/// </remarks>
[StructLayout(LayoutKind.Sequential)]
public struct RectStruct
{
/// <summary>
/// The x-coordinate of the upper-left corner of the rectangle.
/// </summary>
public int Left;
/// <summary>
/// The y-coordinate of the upper-left corner of the rectangle.
/// </summary>
public int Top;
/// <summary>
/// The x-coordinate of the lower-right corner of the rectangle.
/// </summary>
public int Right;
/// <summary>
/// The y-coordinate of the lower-right corner of the rectangle.
/// </summary>
public int Bottom;
public static implicit operator Rect(RectStruct rect)
{
return new Rect(0, 0, rect.Right - rect.Left, rect.Bottom - rect.Top);
}
}
}