microsoft / microsoft/WPF-Samples

Application level Monitor Configuration : DPI per monitor

Open
#306 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
5.7k
Forks
3.3k
Avg merge
12d 8h
Merged PRs (30d)
2

Description

Application level Monitor Configuration : DPI per monitor

I am working on a medical application where we have maximum 3 top level windows. All the 3 windows has to be showed in full screen over the task bar. Windows will be in frame-less and will show custom title bar at the top. Windows location and size are auto-detected by application and user do not have control over it.

Application Basic flow:
When application is launched only primary window (full-screen)will be displayed with login page. Once user logins logins, he can see patients list. When user opens any patient data, primary window will be hidden and patient data will be opened in 2nd and 3rd window respectively(both full screen). 2nd window replaces the primary window which was hidden and 3rd window will be displayed in new monitor.

Currently we are trying to implement special configuration to choose 2 monitors from system where our top level windows will display.
e.g If a system is having 5 monitors connected (some hospitals reading rooms have) user can choose 2 monitors from 5. Say user is choosing 3 and 4 as monitors for our application. Our application should display 1st and 2nd windows(exclusive) on monitor3 and 3rd window in monitor4.

Problem:
I am using System.Windows.Forms.Screen.AllScreens to get screen coordinates. Since we enabled perMonitor configuration in app.manifest we get physical coordinates of the monitors. This is working only for monitors all set to 100% dpi. When any of the monitor dpi changes wpf again apply a scaling and windows are clipping this monitors. Means we cannot get the coordinates working.

When I remove all the dpiaware setting in manifest, OS automatically scales the window but windows are blurred that is not desirable for medical application where image quality will be at maximum expectation.

I tried this but not working.
PerMonitorDPI

Initially I tried this it seems to be working if I comment the Height and Width scaling in PerMonitorDPIWindow.OnLoad. But is was working only for .net4.5 . after I integrated to our application(.Net 4.7.2 ) newer .Net automatically again apply scaling.
PerMonitorDPIAware

Basically is need virtual coordinates of the monitors so that I can able to set the bounds (Top,Left ,Width,Height) can be set. Screen.AllScreen gives only physical coordinates. Please provide we a way how to get this working.

Thank you,
Gnanamurugan

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked PerMonitorDPI and PerMonitorDPIAware samples, then reproduce the behavior using System.Windows.Forms.Screen.AllScreens and PerMonitorDPIWindow.OnLoad on .NET 4.7.2 with monitors at different DPI settings. Compare physical and virtual coordinates and determine what a supported approach would need to provide; completion is unclear because the issue does not specify a concrete repository change or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.