Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - High-DPI 4k resolution - Automatic scaling
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

High-DPI 4k resolution - Automatic scaling

 Post Reply Post Reply
Author
Message
g_j_a_i_n View Drop Down
Groupie
Groupie
Avatar

Joined: 27 August 2005
Status: Offline
Points: 94
Post Options Post Options   Thanks (0) Thanks(0)   Quote g_j_a_i_n Quote  Post ReplyReply Direct Link To This Post Topic: High-DPI 4k resolution - Automatic scaling
    Posted: 15 September 2016 at 6:33am

Hello,

I just upgraded to v17.2 mainly for the High-DPI support.

I want to know that if I just build with the new version, with my app automatically scale on High-DPI resolution (4k resolution) ?

Or should I write some code to enable it? I am using Tab control, report view control, toolbars and menu bars with 16x16 icons.

So will these 16x16 icons scale automatically? I don't mind if  they are blurred initially.

Also, if my image list contains 32x32 icons or 128x128 icons, will the frame work use them automatically when scaling up?

Please this is urgent.

Regards,
Gautam Jain

Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2016 at 2:52pm
Hello Gautam Jain,

Tab control and report control don't support DPI scaling.

Toolbars and menu bars are support choosing icons with appropriate size (if icon has several sizes in one file), but unfortunately with some bugs. We are working on this now.

Regards,
 Oleksandr Lebed
Back to Top
g_j_a_i_n View Drop Down
Groupie
Groupie
Avatar

Joined: 27 August 2005
Status: Offline
Points: 94
Post Options Post Options   Thanks (0) Thanks(0)   Quote g_j_a_i_n Quote  Post ReplyReply Direct Link To This Post Posted: 16 September 2016 at 3:00am
Thanks @olebed for the information.

So I will have to do some coding for tab control and report control.

Can you tell me what is the correct way to detect if the user is having High-DPI or not? How do I decide when to use an icon of higher resolution?

Are there any XTP or Windows functions for that?

Regards,
Gautam Jain
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 16 September 2016 at 3:31am
to detect if the user is having High-DPI or not
use our drawing helper class CXTPDpi  (or global XTPDpiHelper() )
call 
XTPDpiHelper()->GetDPIX() or XTPDpiHelper()->GetDPIY()  to obtains horizontal and vertical DPI values for the system, device context or window handle.

>How do I decide when to use an icon of higher resolution?
Library should make it automatically - size of icon is chosen for available space in ToolBar or Ribbon. Also some options in CommandBars are taken into account and can affect to size of bars/buttons/icons.
Back to Top
g_j_a_i_n View Drop Down
Groupie
Groupie
Avatar

Joined: 27 August 2005
Status: Offline
Points: 94
Post Options Post Options   Thanks (0) Thanks(0)   Quote g_j_a_i_n Quote  Post ReplyReply Direct Link To This Post Posted: 17 September 2016 at 1:36am
Fantastic! Thanks :)
Back to Top
g_j_a_i_n View Drop Down
Groupie
Groupie
Avatar

Joined: 27 August 2005
Status: Offline
Points: 94
Post Options Post Options   Thanks (0) Thanks(0)   Quote g_j_a_i_n Quote  Post ReplyReply Direct Link To This Post Posted: 17 September 2016 at 1:52am

When can we expect a fix. In how many weeks?

Will it be in 17.3?
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 17 September 2016 at 1:55am
I'm not sure about v17.3.  Fix need many changes which should be very neat.  The same code used for drawing controls on all commandBars, ribbon. Also many themes should be tested. The same code supports very old features near new. So we need to care all of them.
Back to Top
g_j_a_i_n View Drop Down
Groupie
Groupie
Avatar

Joined: 27 August 2005
Status: Offline
Points: 94
Post Options Post Options   Thanks (0) Thanks(0)   Quote g_j_a_i_n Quote  Post ReplyReply Direct Link To This Post Posted: 04 November 2016 at 7:25am
Hello @Olebed,

Now that 17.3 is released can you tell me if:

1. The menu bar will be automatically scaled on 4k display? The text and icon
2. What if the icon is only 16x16, will the menu bar still be scaled?
3. Same question 1 and 2 for toolbars also
4. Same question 1 for Report control header also
5. In order to detect 4k display what is the minimum resolution you check or minimum DPI?

Sorry, I don't have a 4k monitor yet. So cannot test it myself.

Thanks for your help.
Back to Top
g_j_a_i_n View Drop Down
Groupie
Groupie
Avatar

Joined: 27 August 2005
Status: Offline
Points: 94
Post Options Post Options   Thanks (0) Thanks(0)   Quote g_j_a_i_n Quote  Post ReplyReply Direct Link To This Post Posted: 04 November 2016 at 10:57am
In addition to above questions, also tell me about status bar scaling.

Thanks.
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 08 November 2016 at 1:43pm
questions 1-3. Size of toolbars, menubars and other command bars and their text and icons  are depend on system DPI. For 100% DPI (96 dpi) its height is 25px. 
200% (192 dpi) -> 50px, 
300% (288 dpi) -> 75px and so on.

question 2. Yes, if the icon is only 16x16, then the menu bar still be scaled.

question 4. ReportControl don't support High DPI scaling. Size of elements depend on size of font and can be changed by developer.

question 5
. User can set any available DPI on 4k display. That is why we take into account only system DPI settings.

I see many question about size of icons in CommandBars (also in Ribbon, ToolBar, MenuBar) so I have described detail it there.

Originally posted by g_j_a_i_n g_j_a_i_n wrote:

In addition to above questions, also tell me about status bar scaling.

StatusBar is scaled according to system DPI.
Back to Top
g_j_a_i_n View Drop Down
Groupie
Groupie
Avatar

Joined: 27 August 2005
Status: Offline
Points: 94
Post Options Post Options   Thanks (0) Thanks(0)   Quote g_j_a_i_n Quote  Post ReplyReply Direct Link To This Post Posted: 09 November 2016 at 12:30am
Great! Thanks for the detailed help.

Wish you the best!

Regards,
Gautam Jain
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.