question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Touch/Stylus pen drawing on WPF InkCanvas is not DPI Aware.

See original GitHub issue
  • .NET Core Version: Not tested
  • Windows version: (winver) 1909 or later
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
  • Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc…)? No

Problem description: When Per Monitor DPI Awareness is enabled, Ink Strokes with touch/Stylus pen on WPF InkCanvas are drawn wrong scale/position after monitor DPI changed.

Per Monitor DPI Awareness works well with touch/stylus pen for button click, element dragging on Canvas, and so on. However, InkCanvas may not aware DPI change and follow primay screen scale.

Actual behavior:

Mouse drawing works correctly but, Inks with Touch/stylus pen are drawn to incorrect position/size after MainWindow is moved to extended monitor with different scale.

Expected behavior:

Inks with Touch/stylus pen must be drawn to correct position/size after MainWindow is moved to extended monitor with different scale.

Minimal repro:

The issue can be reproduce as the following step (two monitors are required).

  1. Create a WPF application (.NET Framework 4.0~4.8)
  2. Add a InkCanvas control in MainWindow.
  3. Set Per Monitor DPI Awareness setting as https://github.com/microsoft/WPF-Samples/tree/main/PerMonitorDPI
  4. Set the scale of each monitor with different value like 100% for Display1 and 125% for Display2.
  5. Run the application and move window to extended monitor.
  6. Draw inks with mouse/touch/stylus pen.
  7. Mouse strokes are correct but touch/stylue pen strokes are not correct (the stroke points may be scaled according to the difference between monitor scales.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
pchaurasia14commented, Nov 9, 2022

@lindexi - Fixes on .NET Framework will be limited to security vulnerabilities or bugs that are filed as DTS issues.

1reaction
lindexicommented, Nov 9, 2022

@jheraldP Sorry, I don’t know.

@singhashish-wpf Could I ask you it will be merged on .NET Framework 4.8?

Read more comments on GitHub >

github_iconTop Results From Across the Web

When using WPF InkCanvas, the width and height values ...
However, the location matches on the connected touch monitor, but the stroke size is not drawn properly. I'm drawing with a stylus pen....
Read more >
WPF InkCanvas drawing width/height not consistent in ...
I can draw strokes both using mouse and touch input. The behavior is consistent as far as stroke width/height are concerned (they are...
Read more >
Drawing And Inking Using New InkCanvas Control For ...
I am going to show the use of InkCanvas control to capture the user touch input and save it as image. In Windows...
Read more >
Sensors - RSSing.com
The application supports standard multi-touch manipulations to move, rotate, and size the images on the board. Anything “drawn” on the board with a...
Read more >
MDN 1015D2 | PDF | Microsoft Visual Studio | Windows 10
taken not to hold on to it following the call to EndDraw. The render target is now ready to go, but isnt aware...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found