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


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

$ form = new-object system.Windows.Forms.Form $ form.ShowDialog ()

There is a false set before and after the visible. Show Dialog ()

But when I do. Nothing appears on the screen:

  $ form.Show ()  

and .Vijay is now true (probably because of the set). () Form was officially seen.)

When I try now. Show Dialog () Again, I get the following error message:

"The form that is already visible can not be displayed as a modal dialog box. Set the visible property of the form before doing so. "

But when I follow the instructions () Again

  $ form.Visible = 0 $ form.ShowDialog ()  

The result is that nothing is displayed on the screen And PowerShell is hangy and can not be cured (ctrl-c doesn work) I believe this form is being displayed in a mapic form somewhere where I can not see it (or tab). but why?

The coordinates of this form have not changed. So how does it decide that it is physically visible and when it is not?

Avoid using the Show () from PowerShell as it requires a message pump and There is nothing like the PowerShell console that provides your form on the thread. ShowDialog () works because the OS pumps the message during this model call. Creating a form and calling Sodiology () works reliably for me.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -