NET Core OnDoubleClick not triggered on Custom High DPI

64 Views Asked by At

It's a very weird, clueless and rare thing. I have a Class Library (component) on NET CORE 6, I change my Windows 11's Dpi to a Custom 200%, the OnDoubleClick has no response. But OnClick did trigger. I try to change to another custom Dpi 144%, OnDoubleClick responses. Those normal Dpi 100%/125%/150% and 175% (168Dpi) all are OK. The demo I tested is manifested and marked PerMonitorV2 and Windows 10 ID.

protected override void OnClick(EventArgs e)
{
    Debug.Print("OnClick triggered");
    base.OnClick(e);
}
protected override void OnDoubleClick(EventArgs e)
{
    Debug.Print("OnDoubleClick triggered"); 
    base.OnDoubleClick(e);
}

Edited: After few try, the max Custom Dpi is 195% (187 dpi), above 196%,OnDoubleClick fails to trigger.

1

There are 1 best solutions below

0
On

It is my fault, not .NET 6 problem. The place of OnDoubleClick has a floating PictureBox (picTip for resizing tips, TopMost), when on 200%, the picTip.Location has no enough offsets in result that the DoubleClick goes to picTip instead of my component UserControl. I put few pixels offset then everything is working fine.

Why OnClick is working? it is because OnClick is earlier than picTip showing up. Why OnDoubleClick is not being trigger for this case? it is because before OnDoubleClick, picTip already show, so DoubleClick goes to TopMost PictureBox instead of my component UserControl.

Lesson Learning: My apps need more intense tests on variable high Dpi situations.