1
あなたが現在いるコンピュータに関する情報を提供するフォームを作成しました。私たちがDPIについて考えなかったサーフェスpro4にデプロイしたとき、テストが爆発的になり、フォームには判読できません。下記参照。高いDPI powershellフォーム
BAD形式:
これは、それがどのように見えるべきかです:
を私はすべてのAutoSizeModeを試してみましたが、グループとテーブルに置くしているし、何も動いていないようにみえ。誰かが良い解決策を持っているかどうかを見るためにStackOverflowに載せています。ここでは、フォームへの私のベースである:
#Background Image
$Image = [system.drawing.image]::FromFile("Desktop.jpg")
$Form.BackgroundImage = $Image
$Form.BackgroundImageLayout = "Stretch"
#button
$Button = New-Object System.Windows.Forms.Button
$Button.TabIndex = 0
$Button.Name = "Button"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Width = 160
$System_Drawing_Size.Height = 30
$Button.Size = $System_Drawing_Size
$Button.UseVisualStyleBackColor = $True
$Button.Text = "Button"
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 13
$System_Drawing_Point.Y = 230
$Button.Location = $System_Drawing_Point
$Button.DataBindings.DefaultDataSourceUpdateMode = 0
$Button.add_Click({Function1})
$Font = New-Object System.Drawing.Font("Calibri",11.5 [System.Drawing.FontStyle]::Regular)
$Form.Font = $Font
#Lables for the computer information and displays them
$Label = New-Object System.Windows.Forms.Label
$Label.Text = "`n Phone: $CallServiceDesk `n E-Mail: `n IP Address: $IPAddress `n Computer Name: $env:computername `n Username: $env:username `n Domain: $env:userdomain `n HomeServer: $env:HOMESERVER `n AssetTag: $env:TIA `n Service Tag: $env:servicetagsn `n McAfee Proxy: $Proxy"
$Label.BackColor = "Transparent"
$Label.AutoSize = $True
$Form.Controls.Add($Email_Label)
$Form.Controls.Add($Call_Label)
$Form.Controls.Add($Label)
$Form.Controls.Add($Button)
$Form.Controls.Add($Learn_Label)
$Form.ShowDialog()
if ($Form -eq "Cancel"){exit}