按钮和标签缩放问题

时间:2017-05-23 15:00:12

标签: powershell scale dpi

我有带有Form和几个按钮的Powershell脚本,并希望使用DPI缩放来获得不同的客户端分辨率。 我从有关自动缩放的Creating a DPI-Aware Application主题中读到并使用它。但是,所有控件都不使用缩放,并且对于不同的分辨率具有相同的大请帮我解决这个问题。

$form_main = New-Object 'System.Windows.Forms.Form'
$form_main.width=360
$form_main.height=300
$form_main.Icon = Return1CIcon
$form_main.FormBorderStyle = "FixedSingle"
$form_main.Text = "1C Start"
$form_main.MinimizeBox=$False
$form_main.MaximizeBox=$False
$form_main.StartPosition = "CenterScreen"
$form_main.AutoScaleDimensions = New-Object System.Drawing.SizeF([double] 96,[double] 96) 
$form_main.AutoScaleMode = "DPI"
$btn_1c =New-Object System.Windows.Forms.Button
$btn_1c.Size = '150,150'
$btn_1c.BackColor = "White"
$btn_1c.BackgroundImage = Return1cLogo
$btn_1c.BackgroundImageLayout = "Zoom"
$btn_1c.Location ='20,20'
$btn_1c.Name = '1CButton'
$btn_1c.TabIndex=0
$lbl_1c = New-Object System.Windows.Forms.Label
$lbl_1c.Text = "Start 1C"
$lbl_1c.Location = '40,190'
$lbl_1c.TabIndex=2
$btn_1cterm =New-Object System.Windows.Forms.Button
$btn_1cterm.Size = '150,150'
$btn_1cterm.BackColor = "White"
$btn_1cterm.BackgroundImage = Return1cTermLogo
$btn_1cterm.BackgroundImageLayout = "Zoom"
$btn_1cterm.Location ='190,20 '
$btn_1cterm.Name = '1CButtonTerm'
$btn_1cterm.TabIndex=1
$lbl_1cterm = New-Object System.Windows.Forms.Label
$lbl_1cterm.Text = "Start 1c 2"
$lbl_1cterm.Location = '200,190'
$form_main.Controls.Add($btn_1c)
$form_main.Controls.Add($lbl_1c)
$form_main.Controls.Add($btn_1cterm)
$form_main.Controls.Add($lbl_1cterm)
$form_main.Showdialog()

0 个答案:

没有答案