使用 PowerShell 在窗格中查看 .htm 报告的 GUI 工具

GUI Tool using PowerShell to view .htm report in pane

我是 PowerShell 的新手,谁能帮助我实现这一目标。

我正在尝试构建一个执行以下操作的 GUI 工具。

  1. 它应该适合屏幕
  2. 我创建了一个按钮,单击该按钮后,(.html) 页面中的结果输出应适合该窗格,并且应反映在同一 GUI 的右侧窗格中工具.

到目前为止我已经尝试了下面的代码。

#Create Form Object
$Form = New-Object System.Windows.Forms.Form
$Form.Size = New-Object System.Drawing.Size(400,300)
$Form.Text = "US ABC 3.0"
$Form.StartPosition = "CenterScreen" #loads the window in the center of the screen

#Link Label 1
$LinkLabel1 = New-Object System.Windows.Forms.LinkLabel
$LinkLabel1.Location = New-Object System.Drawing.Size(30,50)
$LinkLabel1.Size = New-Object System.Drawing.Size(300,30)
$LinkLabel1.LinkColor = "BLUE"
$LinkLabel1.ActiveLinkColor = "RED"
$Linklabel1.AutoSize= $true
$LinkLabel1.Text = "US ABC 3.0 AOReport"
$LinkLabel1.add_Click({[system.Diagnostics.Process]::start("C:\temp\DatabaseStatusReport.htm")})
$Form.Controls.Add($LinkLabel1) 

$textLabel1 = New-Object System.Windows.Forms.Label
$TextLabel1.Location = New-Object System.Drawing.Size(30,90)
$TextLabel1.Size = New-Object System.Drawing.Size(200,10)
$Textlabel1.AutoSize= $true

$textLabel1.Font = New-Object System.Drawing.Font("TIMES NEW ROMAN",09,[System.Drawing.FontStyle]::Bold)

$Form.Controls.Add($TextLabel1) 


#Show Form
$Form.ShowDialog()

请查看下面的输出:

我想把我的输出如下:

我想在单击按钮时在右窗格中查看 .htm 或 .html 报告输出(比方说 DatabaseReport)

抱歉,如果这不是您要查找的内容。您只想玩一下尺寸:

#Create Form Object
$Form = New-Object System.Windows.Forms.Form
$Form.Size = New-Object System.Drawing.Size(700,400)
$Form.Text = "US ABC 3.0"
$Form.StartPosition = "CenterScreen" #loads the window in the center of the screen

#Link Label 1
$Button1 = New-Object System.Windows.Forms.Button
$Button1.Location = New-Object System.Drawing.Size(10,20)
$Button1.Size = New-Object System.Drawing.Size(100,30)
$Button1.AutoSize= $true
$Button1.Text = "US ABC 3.0 AOReport"
$Form.Controls.Add($Button1) 

#Load Web Browser
$Button1.add_Click({
$webBrowser1 = New-Object System.Windows.Forms.WebBrowser
$webBrowser1.Location = New-Object System.Drawing.Size(10,60)
$webBrowser1.Size = New-Object System.Drawing.Size(650,300)
$webBrowser1.URL="C:\temp\DatabaseStatusReport.htm"
$Form.Controls.Add($webBrowser1) })


#Show Form
$Form.ShowDialog()

Source