Query of the scaling (Zoom/HiDPI) level of ComBar? |
Post Reply |
Author | ||||
Fritzchen
Groupie Joined: 13 December 2017 Location: Germany Status: Offline Points: 27 |
Post Options
Thanks(0)
Posted: 18 December 2017 at 10:57am |
|||
Hello!
I have an urgent question about CommandBar and HiDPI scaling (zoom): The Control CommandBar can automatically resize the icon. This means that you need to know which scaling (zoom) the user has set in Windows. Can I retrieve this information from the CommandBar control (or any other control of CodeJock Suite)? That would be a great idea! This would allow a developer to get the HiDPI settings and adjust other controls directly (e. g. reload larger images, adjust other controls, etc.). It would be really nice if you could provide this information in the CommandBar! I have the CommandBar 18.0.1 and VB6 Pro. |
||||
olebed
Admin Group Joined: 01 July 2014 Location: Ukraine Status: Offline Points: 841 |
Post Options
Thanks(0)
|
|||
Hello,
You don't need to know DPI of your monitor. You just need to load icons with different sizes, multiple 8 - 16х16, 24, 32, 40, 48, 56 and other if you going to use your application in very big monitors.
See our sample CommandBars\VB\RibbonSample\frmMain.frm method LoadIcons()
Regards, Oleksandr Lebed |
||||
rmcmanamy
Groupie Joined: 02 September 2009 Status: Offline Points: 54 |
Post Options
Thanks(0)
|
|||
You might also need to calculate your own GetClientRect since I believe the Commandbars returns the wrong one if you are trying to get it in Twips once you set the Windows Text Scaling over 175%. Something like this might work although I haven't tested it on dual monitors with different text scaling.
Public Sub Commadbars_GetClientRect(ByVal oCommandBars As CommandBars, ByRef Left As Long, _ ByRef Top As Long, ByRef Right As Long, ByRef Bottom As Long) On Error Resume Next 'This fixes the GetClientRect bug with 175% and larger Text Scaling Dim oOldScaleMode As XTPScaleMode oOldScaleMode = oCommandBars.ScaleMode oCommandBars.ScaleMode = xtpScalePixel oCommandBars.GetClientRect Left, Top, Right, Bottom oCommandBars.ScaleMode = oOldScaleMode Left = Left * Screen.TwipsPerPixelX Top = Top * Screen.TwipsPerPixelX Right = Right * Screen.TwipsPerPixelX Bottom = Bottom * Screen.TwipsPerPixelY End Sub |
||||
Product: Xtreme SuitePro (ActiveX Unicode) version 22.0.0
Platform: Windows 11 (64bit) Language: Visual Basic 6.0 |
||||
Fritzchen
Groupie Joined: 13 December 2017 Location: Germany Status: Offline Points: 27 |
Post Options
Thanks(0)
|
|||
@olebed, rmcmanamy,
thanks for the tips I will test today! @oledeb: Yes I know that CommandBar can customize the icon itself. Thanks for the advice! My question was, as recognized by rmcmanamy, whether it is possible to query the current DPI via the CommandBar. Under Windows 7 there is no "shcore. dll": - ( I'll try both tips. Thank you! Fritzchen |
||||
olebed
Admin Group Joined: 01 July 2014 Location: Ukraine Status: Offline Points: 841 |
Post Options
Thanks(0)
|
|||
|
||||
Fritzchen
Groupie Joined: 13 December 2017 Location: Germany Status: Offline Points: 27 |
Post Options
Thanks(0)
|
|||
Hello everyone,
thanks for your information @olebed. Unfortunately, this doesn't help me either, as the results depend on the resolution and vary depending on the screen (HIDPI). Question: Is there a way to query the current ICON size in the ribbon bar? That would be enough for me, because that way I could customize graphics in other controls. Thanks! Fritzchen |
||||
olebed
Admin Group Joined: 01 July 2014 Location: Ukraine Status: Offline Points: 841 |
Post Options
Thanks(0)
|
|||
These two functions (GetDpiForMonitor and GetDeviceCaps) are used internally in library.
If you don't set custom icon size for Ribbon/CommandBar or for separately control then used method GetAutoIconSize
"XTP_DPI_Y(4)" can be calculated with GetDpiForMonitor and GetDeviceCaps. so for my test machine Win7: 100%: 23 - XTP_DPI_Y(4) -> 23 - 4 = 19 -> 16x16 and 32x32 120%: 27 - XTP_DPI_Y(4) -> 27 - 5 = 22 -> 16x16 and 40x40 125%: 29 - XTP_DPI_Y(4) -> 29 - 5 = 24 -> 24x24 and 48x48 135%: 31 - XTP_DPI_Y(4) -> 31 - 5 = 26 -> 24x24 and 48x48 150%: 35 - XTP_DPI_Y(4) -> 35 - 6 = 29 -> 24x24 and 56x56 175%: 41 - XTP_DPI_Y(4) -> 41 - 7 = 34 -> 32x32 and 64x64 200%: 47 - XTP_DPI_Y(4) -> 47 - 8 = 39 -> 32x32 and 72x72
|
||||
Fritzchen
Groupie Joined: 13 December 2017 Location: Germany Status: Offline Points: 27 |
Post Options
Thanks(0)
|
|||
Hello @olebed,
thank you for your explanation! That brings me forward now - thank you very much! Note: Are you on the developer team? The problems with HiDPI must be solved urgently. Controls are drawn with zoom (DPI) > 150% incorrectly. This is a real problem for HiDPI monitors, Surface devices etc... Is there a correction planned for the upcoming release? Best regards Fritzchen |
||||
olebed
Admin Group Joined: 01 July 2014 Location: Ukraine Status: Offline Points: 841 |
Post Options
Thanks(0)
|
|||
Hello Fritzchen,
Yes, I'm from development team, and it is known issue with HiDPI. It is present in our task/bugs list. We are concentrate on other problems now. Regards, Oleksandr Lebed |
||||
Fritzchen
Groupie Joined: 13 December 2017 Location: Germany Status: Offline Points: 27 |
Post Options
Thanks(0)
|
|||
Hello Oleksandr,
thanks for your quick answer! Many thanks and good luck for the further development! I'm staying on lookout! Regards Fritzchen |
||||
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |