-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a few device context bits and sort NativeMethods.txt.
- Loading branch information
1 parent
3d137c0
commit d355c29
Showing
5 changed files
with
74 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) Jeremy W. Kuhne. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System.Drawing; | ||
using Windows.Win32; | ||
using Windows.Win32.Graphics.Gdi; | ||
|
||
namespace Windows; | ||
|
||
public unsafe class DeviceContextTests | ||
{ | ||
[Fact] | ||
public void DeviceContext_ScreenDeviceContextBehavior() | ||
{ | ||
using DeviceContext context = DeviceContext.Create(); | ||
int logicalDpi = context.GetDeviceCaps(GET_DEVICE_CAPS_INDEX.LOGPIXELSX); | ||
|
||
Point point = new(0, 8192); | ||
Interop.LPtoDP(context, &point, 1); | ||
point.Should().Be(new Point(0, (int)(8192 * (logicalDpi / (float)Interop.USER_DEFAULT_SCREEN_DPI)))); | ||
} | ||
} |