dotnet / dotnet/wpf

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

Open
#6,859 6 comments 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

* .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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.