Im going through https://info.sapien.com/index.php/guis/ ... i-displays.
It mentions that for all controls, the minimum and maximum size needs to be scaled.
Does this apply if all my controls have zero for both minimum and maximum size?
The convert-toscaledpixel function only needs to be set for Listview, splitcontainer and treeview controls?
High DPI question
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: High DPI question
I have worked through all the modifications as recommended and I have run into a problem.
I have a project with about 24 different forms. Some of the forms resized fine and some didnt when I changed the monitor scale.
What I noticed was that for the forms that resized correctly , the font property on the form control itself was set to default i.e. Microsoft Sans Serif, 8.25pt.
So I modified one of the forms that didnt resize properly that had a different font setting on the Form control back to the default.
I can see that it worked as the font property for that form is not bolded.
All the controls within that form, as recommended, have manual font settings e.g. labels and textboxes etc.
My issue is that it still does not resize properly. The controls are running into each other and the text size didnt change.
Any ideas?
I have a project with about 24 different forms. Some of the forms resized fine and some didnt when I changed the monitor scale.
What I noticed was that for the forms that resized correctly , the font property on the form control itself was set to default i.e. Microsoft Sans Serif, 8.25pt.
So I modified one of the forms that didnt resize properly that had a different font setting on the Form control back to the default.
I can see that it worked as the font property for that form is not bolded.
All the controls within that form, as recommended, have manual font settings e.g. labels and textboxes etc.
My issue is that it still does not resize properly. The controls are running into each other and the text size didnt change.
Any ideas?
Re: High DPI question
I fixed the above problem!
What I did was to 'pretend' to change the font properties for all controls on the form.
i.e. I selected the controls and opened the font dialogue and changed the font style from regular to bold and then back to regular.
What I did was to 'pretend' to change the font properties for all controls on the form.
i.e. I selected the controls and opened the font dialogue and changed the font style from regular to bold and then back to regular.
Re: High DPI question
Thanks for that article. For a long time I put my apps in the 'high dpi' too hard basket.
Following the article along with the 'pretend' font changes has worked a treat.
There was one thing that I was wondering about.
When I change the size in the display settings to %200, the fonts are resized accordingly but look a bit fuzzy. I noticed that one of the Window pop dialogue boxes had fonts resized that were smooth.
Its as though the latter popup was using a different font rendering technique.
Is it possible to do that with my PS studio apps? i.e. using a specific font that resizes smoothly?
Following the article along with the 'pretend' font changes has worked a treat.
There was one thing that I was wondering about.
When I change the size in the display settings to %200, the fonts are resized accordingly but look a bit fuzzy. I noticed that one of the Window pop dialogue boxes had fonts resized that were smooth.
Its as though the latter popup was using a different font rendering technique.
Is it possible to do that with my PS studio apps? i.e. using a specific font that resizes smoothly?
Re: High DPI question
Continuing with my scaling saga. Came across a new one today.
When I was trying to do the scaling using the column.width, it was working fine until....
I had a form with a list view and only one column. When changing the monitor scale to 200% it was reporting the column.width property as zero. At 100% the column.width reported fine.
The workaround was to add another column with a width of one and that fixed it.
When I was trying to do the scaling using the column.width, it was working fine until....
I had a form with a list view and only one column. When changing the monitor scale to 200% it was reporting the column.width property as zero. At 100% the column.width reported fine.
The workaround was to add another column with a width of one and that fixed it.
Re: High DPI question
So the above fix worked but I dont have all the screen resolutions to test.Lembasts wrote: ↑Mon Feb 20, 2023 7:13 pm Continuing with my scaling saga. Came across a new one today.
When I was trying to do the scaling using the column.width, it was working fine until....
I had a form with a list view and only one column. When changing the monitor scale to 200% it was reporting the column.width property as zero. At 100% the column.width reported fine.
The workaround was to add another column with a width of one and that fixed it.
Turns out that for a resolution of 3840 X 2160 at 150%, the column width is reporting as zero for some but not all listviews. If I set the size to 100%, column width is reporting correctly.
I use the following function for all my listviews:
Code: Select all
function Set-LVColumnScale ($listview)
{
foreach ($column in $listview.columns)
{
$column.width = ConvertTo-ScaledPixel -Form $global:CurrentForm -Width $column.width
}
}
But not for all list views and not for the vast majority of resolutions.
All the form controls that have listviews have their font all set to the default - Microsoft sans serif 8.25.
Every listview has specifically been set a different font (verdana 8.25).
All the listviews, working and not, have preset column collections with preset column widths i.e. no dynamically created columns.
In looking at all the listviews, working or not, there doesnt seem to be a specific property that is different between working and not working listviews.
I have to find a fix though....
Re: High DPI question
So I exported the code and saw that for both the listviews that worked and the listviews that didnt work that the columns were added to the controls with the appropriate width property set.
So I tried this for one of the listviews that didnt work.
I deleted the manually added column in the PS IDE and ran this line of code at the very beginning of the form load event:
Now why this is happening is another matter but at least I have a workaround.
So I tried this for one of the listviews that didnt work.
I deleted the manually added column in the PS IDE and ran this line of code at the very beginning of the form load event:
and guess what - it worked! The column width was reported correctly.[void]$listviewMembers.Columns.Add('Members', 'Group Members',500)
Now why this is happening is another matter but at least I have a workaround.