PowershellのWindows.Formで「Marquee」タイプのプログレスバーを表示したいです。
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
$window = New-Object Windows.Forms.Form
$window.Size = New-Object Drawing.Size @(400,75)
$window.StartPosition = "CenterScreen"
$window.Font = New-Object System.Drawing.Font("Calibri",11,[System.Drawing.FontStyle]::Bold)
$window.Text = "STARTING UP"
$ProgressBar1 = New-Object System.Windows.Forms.ProgressBar
$ProgressBar1.Location = New-Object System.Drawing.Point(10, 10)
$ProgressBar1.Size = New-Object System.Drawing.Size(365, 20)
$ProgressBar1.Style = "Marquee"
$ProgressBar1.MarqueeAnimationSpeed = 20
$window.Controls.Add($ProgressBar1)
$window.ShowDialog()
ISEでは表示されますが、単独で実行した場合、「Marquee」表示がされず、バーの枠だけ表示されます。
https://stackoverflow.com/questions/24294292/power-shell-marquee-progress-bar-not-working
上記HPがまさにこの状態で、3行目に「System.Windows.Forms.Application::EnableVisualStyles()
」を追加しましたが動きませんでした。どうすれば「Marquee」表示されるようになりますでしょうか?
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。