Hi all
Did anyone have same experience about,
when the windows form scripts run in PowerShell ISE, the pixel is good.
After save as .ps1 file and directly "right click -> run with PowerShell ", the pixel go down. And also, the size will change.
Here is the output and my scripts.


---------------------------------------------------------------------------------
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
$S_Form = New-Object Windows.Forms.Form -Property @{
StartPosition = [Windows.Forms.FormStartPosition]::CenterScreen
#Size = New-Object Drawing.Size 200, 200 #size (280,250)
Text = "Select a Start Date."
TopMost = $true
AutoSize = $true
}
$S_Label = New-Object windows.forms.label -property @{
Location = New-Object drawing.point 0,0
Font = New-Object System.Drawing.Font ("Times New Roman",14)
#Size = New-Object drawing.size 250,30
AutoSize = $true
Text = "Please Select Start Time."
}
$S_Form.Controls.Add($S_Label)
$S_Calendar = New-Object Windows.Forms.MonthCalendar -Property @{
Location = New-Object drawing.point 0,($S_Label.Size.Height)
#Size = New-Object drawing.size 200,200
AutoSize = $true
ShowTodayCircle = $false
ShowToday = $false
MaxSelectionCount = 1
}
$S_Form.Controls.Add($S_Calendar)
write-host "label size is " $S_Label.size
write-host "Calendar size is "$S_Calendar.Size
$result = $S_Form.ShowDialog()
------------------------------------------------------------------------------
I tried to fixed the label and calendar size, the label can work but the calendar still getting smaller.
My question is, How can let the size don't change ?
Best regards,
Thank you