Why does a form displayed by PowerShell sometimes not show up?

前端 未结 2 1020
梦如初夏
梦如初夏 2020-12-11 08:10

When I create a form (window) in PowerShell, I can usually display the form using .ShowDialog():

$form = New-Object System.Windows.Forms.Form
$form.ShowDialo         


        
2条回答
  •  抹茶落季
    2020-12-11 09:08

    Avoid using Show() from PowerShell as it requires a message pump and that isn't something the PowerShell console provides on the thread that creates your form. ShowDialog() works because the OS does the message pumping during this modal call. Creating the form and calling ShowDialog() works reliably for me.

提交回复
热议问题