Skip to content

Fix display scaling and positioning#6

Open
DanielRose wants to merge 4 commits intopeteblois:masterfrom
DanielRose:fix-display-scaling-and-positioning
Open

Fix display scaling and positioning#6
DanielRose wants to merge 4 commits intopeteblois:masterfrom
DanielRose:fix-display-scaling-and-positioning

Conversation

@DanielRose
Copy link
Copy Markdown

This solves some problems:

  1. The primary screen has a top/left position of 0, 0. In a multi-monitor setup, if there are screens to the left/above the primary screen, then those screens have negative coordinates. This corrects the calculations where needed. This fixes Bug in multi-monitor positioning code #5
  2. WPF uses coordinates and sizes based on a virtual 96dpi screen. If a user sets display scaling (ex. 150%), the virtual WPF pixels will not be the same as the native pixels. Besides fixing internal problems related to that, in those cases the "WPF" pixels and "native" pixels are both shown (ex. for bounds, spacing). The WPF value is shown first, with the native value in parentheses.
    • Note that WPF uses the display scaling of the primary screen everywhere. It is possible to have different values per screen, but WPF does not handle that case. In those cases, the "native" values for other screens will be incorrect.
  3. At least in my system, using the DropShadowEffect causes access violations, so I removed it.

Remove dead code.
Harmonize formatting.
The DropShadowEffect can cause access violations.
WPF uses coordinates and sizes based on a virtual 96dpi screen. If a
user sets display scaling (ex. 150%), the virtual WPF pixels will not be
the same as the native pixels.
The primary screen's top/left coordinates are 0,0. When there are
multiple screens, they can be placed to the left and/or above the
primary, which means their coordinates will be negative.
@LadyCritique
Copy link
Copy Markdown

Hello, I have no idea what all the coding means when I look through this information. But I have a very basic question that I hope you can answer. I have an image brought up in Photoshop that is approximately 2357 x 2357 pixels at 300 DPI. When I use the Screen Ruler, it measures the image as 713 x 761. Is there a setting that I need to adjust to make the Screen Ruler read my image exactly (or close) to what the image is?

@DanielRose
Copy link
Copy Markdown
Author

Hello, I have no idea what all the coding means when I look through this information. But I have a very basic question that I hope you can answer. I have an image brought up in Photoshop that is approximately 2357 x 2357 pixels at 300 DPI. When I use the Screen Ruler, it measures the image as 713 x 761. Is there a setting that I need to adjust to make the Screen Ruler read my image exactly (or close) to what the image is?

The screen ruler measure the screen pixels. You are probably not displaying the image at 100% zoom.

@LadyCritique
Copy link
Copy Markdown

LadyCritique commented Mar 13, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug in multi-monitor positioning code

2 participants