System.drawin.sizeF

Ask your PowerShell-related questions, including questions on cmdlet development!
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.
This topic is 5 months and 4 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
DIT-Acquisition
Posts: 31
Last visit: Wed Oct 30, 2024 6:00 am

System.drawin.sizeF

Post by DIT-Acquisition »

Hi,

Since this morning my forms is appearing badly. Colums are overlapping so label are overlapping text box.
I compared various version export
And found in my latest export:

Image

Code: Select all

$formOutilDeMiseEnProduct.Controls.Add($labelVersion05)
	$formOutilDeMiseEnProduct.Controls.Add($labelDate)
	$formOutilDeMiseEnProduct.Controls.Add($labelMEQ)
	$formOutilDeMiseEnProduct.Controls.Add($labelFrançoisRacine)
	$formOutilDeMiseEnProduct.Controls.Add($tab_MEP)
	$formOutilDeMiseEnProduct.Controls.Add($buttonExit)
	$formOutilDeMiseEnProduct.Controls.Add($LabelTcomplete)
	$formOutilDeMiseEnProduct.Controls.Add($labelTraitementDesDonnées)
	$formOutilDeMiseEnProduct.Controls.Add($TXTServeur)
	$formOutilDeMiseEnProduct.Controls.Add($labelServeurDeSite)
	$formOutilDeMiseEnProduct.Controls.Add($ComboBoxSiteProv)
	$formOutilDeMiseEnProduct.Controls.Add($labelCodeDeSite)
	$formOutilDeMiseEnProduct.Controls.Add($buttonQuitter)
	$formOutilDeMiseEnProduct.Controls.Add($buttonMEP)
	$formOutilDeMiseEnProduct.Controls.Add($buttonNext)
	$formOutilDeMiseEnProduct.Controls.Add($buttonPrev)
	[b]$formOutilDeMiseEnProduct.AutoScaleDimensions = New-Object System.Drawing.SizeF(96, 96)[/b]
	$formOutilDeMiseEnProduct.AutoScaleMode = 'Dpi'
	$formOutilDeMiseEnProduct.AutoScroll = $True
	$formOutilDeMiseEnProduct.AutoSizeMode = 'GrowAndShrink'
	$formOutilDeMiseEnProduct.ClientSize = New-Object System.Drawing.Size(1513, 784)
	$formOutilDeMiseEnProduct.Name = 'formOutilDeMiseEnProduct'
	$formOutilDeMiseEnProduct.StartPosition = 'CenterScreen'
	$formOutilDeMiseEnProduct.Text = 'Outil de Mise En Production de trousses (OMEPt)'
	$formOutilDeMiseEnProduct.add_Load($formOutilDeMiseEnProduct_Load)
I found by AutoscaleDimensions at 96,96 the form is almost correct. But I don't see how adjusting it from powershell studio directly. How may I set it from the Powershell studio interface?

Since a year I am maintaining this form. Yesterday, at office on my PC it was looking good. Today the export from yesterday on my laptop and PC everything is almost fine. But if I run from Powershell studio or export the issue is appearing. The only difference is the AutoScaleDimensions setting.

I read from here:https://info.sapien.com/index.php/guis/ ... i-displays that I don't have to set it. OK so now what? Actually, after I export I get 120,120 instead 96,96. What should I do?

Thanks,
by brittneyr » Wed May 08, 2024 10:20 am
That is most likely a result of the screen you are currently using. When changing the value and running the script, you should see the form scale differently. Now whether it is scaling correctly or not is a different issue.

If your form is still not scaling correctly, you should look into design practices to improve the scaling. Handling dpi changes can be difficult and there is no one way to go about as it depends on many factors.
Go to full post
User avatar
brittneyr
Site Admin
Posts: 1803
Last visit: Tue Nov 05, 2024 11:31 am
Answers: 44
Been upvoted: 34 times

Re: System.drawin.sizeF

Post by brittneyr »

This can be set from the script portion of your PSF file via code.

The AutoScaleDimensions property is not browsable and therefore cannot be set from the designer. The Browsable attribute specifies whether a property or event should be displayed in a Properties panel.

For additional information:
https://learn.microsoft.com/en-us/dotne ... work-4.8.1
Brittney
SAPIEN Technologies, Inc.
User avatar
DIT-Acquisition
Posts: 31
Last visit: Wed Oct 30, 2024 6:00 am

Re: System.drawin.sizeF

Post by DIT-Acquisition »

Hi,

OK So I should set it from my code portion. It is still unclear.
What should I set exactly?

Thanks
User avatar
DIT-Acquisition
Posts: 31
Last visit: Wed Oct 30, 2024 6:00 am

Re: System.drawin.sizeF

Post by DIT-Acquisition »

brittneyr wrote: Wed May 08, 2024 7:23 am This can be set from the script portion of your PSF file via code.

The AutoScaleDimensions property is not browsable and therefore cannot be set from the designer. The Browsable attribute specifies whether a property or event should be displayed in a Properties panel.
Hi,

OK So I should set it from my code portion. It is still unclear.
What should I set exactly?

Thanks
User avatar
brittneyr
Site Admin
Posts: 1803
Last visit: Tue Nov 05, 2024 11:31 am
Answers: 44
Been upvoted: 34 times

Re: System.drawin.sizeF

Post by brittneyr »

I was referring to setting the AutoScaleDimensions property of your form. This should be set to the desired value before the form is loaded.

You can try putting this line in the form load event of your script:
  1. $formOutilDeMiseEnProduct.AutoScaleDimensions = New-Object System.Drawing.SizeF(96, 96)

It is also worth mentioning that you might want to look into design practices to improve the scaling of you forms across different resolutions.
You may find the following helpful:
https://info.sapien.com/index.php/guis/ ... i-displays
Brittney
SAPIEN Technologies, Inc.
User avatar
DIT-Acquisition
Posts: 31
Last visit: Wed Oct 30, 2024 6:00 am

Re: System.drawin.sizeF

Post by DIT-Acquisition »

Hi,
brittneyr wrote: Wed May 08, 2024 8:47 am I was referring to setting the AutoScaleDimensions property of your form. This should be set to the desired value before the form is loaded.

You can put this line in the form load event of your script:
  1. $formOutilDeMiseEnProduct.AutoScaleDimensions = New-Object System.Drawing.SizeF(96, 96)

It is also worth mentioning that you might want to look into design practices to improve the scaling of you forms across different resolutions.
You may find the following helpful:
https://info.sapien.com/index.php/guis/ ... i-displays
Sound it cannot be change
$formOutilDeMiseEnProduct_Load={
UpdateNavButtons
$formOutilDeMiseEnProduct.AutoScaleDimensions = New-Object System.Drawing.SizeF(120, 120)
write-host $formOutilDeMiseEnProduct.AutoScaleDimensions
The write-host is returning: {Width=96, Height=96}
Thanks,
User avatar
brittneyr
Site Admin
Posts: 1803
Last visit: Tue Nov 05, 2024 11:31 am
Answers: 44
Been upvoted: 34 times

Re: System.drawin.sizeF

Post by brittneyr »

That is most likely a result of the screen you are currently using. When changing the value and running the script, you should see the form scale differently. Now whether it is scaling correctly or not is a different issue.

If your form is still not scaling correctly, you should look into design practices to improve the scaling. Handling dpi changes can be difficult and there is no one way to go about as it depends on many factors.
Brittney
SAPIEN Technologies, Inc.
This topic is 5 months and 4 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked