How can I get Windows scale?

55 views
Skip to first unread message

Zhipeng Shi

unread,
Oct 9, 2022, 5:57:11 AM10/9/22
to wx-users
How can I get Windows scale?
I am working on Windows 11 (3k monitor), the recommended is 200%), the screen size is 3072x1920.
When I use wxWindow::GetDPIScaleFactor(), it is always get 1.0.
Thank you.2.png

PB

unread,
Oct 9, 2022, 6:04:48 AM10/9/22
to wx-users
Are you running wxWidgets version supporting high DPI, i.e., 3.2 or newer?

Is your application marked as (Per Monitor v2) DPI-aware? You can verify this using Task Manager, in tab Details, in column DPI Awareness which should read "Per-Monitor (v2)" (the column may not be displayed by default so may need to be added).

Did you close and reopen the application after changing the DPI (see the red warning in your screenshot)?


Zhipeng Shi

unread,
Oct 10, 2022, 10:30:01 PM10/10/22
to wx-users
Hi ,
    Thank you very much for your answer.
     The wxWidgets version is 3.2.1.
     And I don't know, why on 3k monitor(resolution is 3072x1920) or 4k monitor(resolution is 3840x2160), I can't get the right resolution through wxGetDisplaySize() ? 
     Thank you. 
Best regards
source.png
normal.png
4k.png
3k.png

Igor Korot

unread,
Oct 10, 2022, 11:30:59 PM10/10/22
to wx-u...@googlegroups.com
Hi,

On Mon, Oct 10, 2022 at 9:30 PM Zhipeng Shi <shizh...@gmail.com> wrote:
>
> Hi ,
> Thank you very much for your answer.
> The wxWidgets version is 3.2.1.
> And I don't know, why on 3k monitor(resolution is 3072x1920) or 4k monitor(resolution is 3840x2160), I can't get the right resolution through wxGetDisplaySize() ?

Are you on Windows?
Is the application marked as DPI Aware as asked by PB?

Thank you.

> Thank you.
> Best regards
> 在2022年10月9日星期日 UTC+8 18:04:48<PB> 写道:
>>
>> Are you running wxWidgets version supporting high DPI, i.e., 3.2 or newer?
>>
>> Is your application marked as (Per Monitor v2) DPI-aware? You can verify this using Task Manager, in tab Details, in column DPI Awareness which should read "Per-Monitor (v2)" (the column may not be displayed by default so may need to be added).
>>
>> Did you close and reopen the application after changing the DPI (see the red warning in your screenshot)?
>>
>>
> --
> Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
> ---
> You received this message because you are subscribed to the Google Groups "wx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to wx-users+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/575c15d6-79b0-4c75-84ad-b7e786547525n%40googlegroups.com.

Zhipeng Shi

unread,
Oct 11, 2022, 3:13:07 AM10/11/22
to wx-users
Hi ,

   Yes , I am on Windows.
   How can I mark the application as DPI Aware ? In the application when I create wxFrame, or , just like the 5.png attachment?
   Thank you.

Best regards
5.png

Zhipeng Shi

unread,
Oct 11, 2022, 10:08:53 PM10/11/22
to wx-users
Hi ,

    Thank you.
    Now I know how to mark DPI Aware.
    Thanks.

Best regards6.png
Reply all
Reply to author
Forward
0 new messages