WindowPosition.cs
1 // Copyright (c) Microsoft Corporation 2 // The Microsoft Corporation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 using Windows.Graphics; 6 7 namespace Microsoft.CmdPal.UI.ViewModels; 8 9 public sealed class WindowPosition 10 { 11 /// <summary> 12 /// Gets or sets left position in device pixels. 13 /// </summary> 14 public int X { get; set; } 15 16 /// <summary> 17 /// Gets or sets top position in device pixels. 18 /// </summary> 19 public int Y { get; set; } 20 21 /// <summary> 22 /// Gets or sets width in device pixels. 23 /// </summary> 24 public int Width { get; set; } 25 26 /// <summary> 27 /// Gets or sets height in device pixels. 28 /// </summary> 29 public int Height { get; set; } 30 31 /// <summary> 32 /// Gets or sets width of the screen in device pixels where the window is located. 33 /// </summary> 34 public int ScreenWidth { get; set; } 35 36 /// <summary> 37 /// Gets or sets height of the screen in device pixels where the window is located. 38 /// </summary> 39 public int ScreenHeight { get; set; } 40 41 /// <summary> 42 /// Gets or sets DPI (dots per inch) of the display where the window is located. 43 /// </summary> 44 public int Dpi { get; set; } 45 46 /// <summary> 47 /// Converts the window position properties to a <see cref="RectInt32"/> structure representing the physical window rectangle. 48 /// </summary> 49 public RectInt32 ToPhysicalWindowRectangle() 50 { 51 return new RectInt32(X, Y, Width, Height); 52 } 53 }