Jump to content

Extended Message Box - DPI Scaling


Recommended Posts

I found it necessary to remove the scaling on line 561 - I still have minor issues with message width.

Local $hMsgGUI = GUICreate($sTitle, $iDialog_Width, $iMsg_Height, $iHpos, $iVPos, BitOR(0x80880000, 0x00C00000), $iExtStyle, $iParent_Win)

I also had some positioning issues with your setup but since I use ini files to track location, I completely removed your screen positioning to substitute my own.
I'll look at that again as time permits.

Link to comment
Share on other sites

  • Moderators

Shark007,

I do not understand how scaling  cannot be required when creating the main dialog. If all the internal controls are scaled, surely the GUI in which they are positioned must also be scaled or it will be to small to hold them.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

The gui is just too large. To me, it looks like the scaling is getting applied twice for the main GUI.

The width issue: The message gui looks fine @ 100% scaling but @ 225% it becomes too skinny.

I'll follow up with some Pics soon. Morning coffee isn't even ready yet.

Link to comment
Share on other sites

Using your latest posting of ExtMsgBox_DPI.au3 and the following context in my App (my app is aprox 500x300 for reference)

Screen positioning is handled by ExtMsgBox_DPI and all of the following pics were positioned by ExtMsgBox_DPI

_ExtMsgBoxSet(0, 0, $Contrast)
_ExtMsgBoxDPIScale($iScale)
_ExtMsgBox(0, 0, 'Instruction', "This button will created 2 WMP shortcuts in the Open With list." & _
        "The lower one is always the 64bit player. ALWAYS select to choose another app and also check the box to Always use," & _
        " then select your prefered player. After doing all filetypes with permission errors," & _
        "Select the appropriate player to use in the App", 0, $SetApp, 0, False)

@225% scaling, I see the following

original225.thumb.jpg.4dc94985ed2301d5428681b849891586.jpg

And @100% i see this

original100.jpg.22efd9b8e3c60abb13c09a782d6a374a.jpg

When I remove the scaling as I pointed out earlier, @225 I see this

scaling_removed.thumb.jpg.c2fa5fc98c21981946a77414a178bb3f.jpg

And @100% it is identical to my previous graphic @100 which does look OK.

Edited by Shark007
Link to comment
Share on other sites

  • Moderators

Shark007,

Using your code I can see some size anomalies too. The dialog size is set by using my StringSize UDF to measure the space needed to display the content - I am wondering if that UDF also needs some tweaking to cope with the DPI scaling.

I did say this was likely to get messy!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

14 minutes ago, Melba23 said:

Using your code I can see some size anomalies too. The dialog size is set by using my StringSize UDF to measure the space needed to display the content - I am wondering if that UDF also needs some tweaking to cope with the DPI scaling.

I did say this was likely to get messy!

M23

Yes, I have come to this same conclusion about StringSize also and was hoping you could get me started with something and I could tweak.
I had a look at it but I'm hoping you could point me in the right direction to get started.

Link to comment
Share on other sites

  • Moderators

Shark007,

The problem is definitely the return from the call to StringSize. In my tests the label is sized at 350x79 when at 100% - while at 175% it returns 350x274.

I will continue looking into the problem as time allows.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I have made good progress tweaking the positioning in relation to a parent gui. (completed)

The StringSize issue is also affecting the message body as it is missing the [OK] button @ any DPI other than 100%

 

I am in no hurry for results. I am testing this with a function that I intend to deprecate
and my initial reason for looking at this has been resolved using SplashTextOn.

Link to comment
Share on other sites

  • Moderators

Shark007,

It seems that you need to factor the text size passed to StringSize - or to be correct to the GetTextExtentPoint32W API call within the UDF - to get a sensible result. Strangely it seems you need to divide by the DPI scaling factor rather then multiply like everywhere else - perhaps because (as you pointed out) Windows automatically scales the font itself. Anyway, the results are much better, but still not perfect so I will continue to work on the issue.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I like that you mentioned 'division because I also am getting better results with the following

Local $hMsgGUI = GUICreate($sTitle, $iDialog_Width * $iDPI, $iMsg_Height / $iDPI + 25 * $iDPI, $iHpos, $iVPos, BitOR(0x80880000, 0x00C00000), $iExtStyle, $iParent_Win)

I'm not even sure why I did that ...   lol  (i'm old, and forgetful)

Edited by Shark007
Link to comment
Share on other sites

  • Moderators

Shark007,

Try this for size: ExtMsgBox_DPI.au3

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Shark007,

I noticed that too and tried to get round it with code like this:

; DPI Aware code
Local $iDPI = $g_aEMB_Settings[14]
Local $iDPIFontSize = Ceiling($g_aEMB_Settings[4] / $iDPI)
Local $iDPIDefFontSize = Ceiling($g_aEMB_Settings[10] / $iDPI)

so that the font was always a trifle on the large side. It seemed to work for me at 175% but the problem obviously still exists at your extreme 225% scaling. You could try adding a bit to the font value and see if that gives a better result:

; DPI Aware code
Local $iDPI = $g_aEMB_Settings[14]
Local $iDPI_Factor = ($iDPI - 1) / 2
Local $iDPIFontSize = Ceiling(($g_aEMB_Settings[4] + $iDPI_Factor) / $iDPI)
Local $iDPIDefFontSize = Ceiling(($g_aEMB_Settings[10] + $iDPI_Factor) / $iDPI)

That way we are scaling the increase to the scaling factor rather than  adding the same amount regardless. And the factoring expression might need a bit of juggling - I leave that to you.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Shark007,

Quote

To my eyes, It seems the entire block of text has shifted downwards

That is not the problem - it is the reduced results from the  StringSize call making the whole label too small for the text at high scaling settings. That is why the text no longer fits and appears cut off. Adding 5 pixels to the label height would be a pure "fudge factor" to get over this and would affect label size at all scalings.  I prefer to look for a programmatic solution if possible.

M23

Edited by Melba23
Added a bit

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...