How to release mouse button when pressed on titlebar while form is disposing and reloading
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: How to release mouse button when pressed on titlebar while form is disposing and reloading
Thanks, that makes sense, I will update to how you've shown it. I considered background jobs but code executes in about 1-2 seconds and didn't seem to freeze anything up, yet. I'll try to figure out a solution to when number of labels/pictures is dynamic, that's when re-starting the form with newly discovered number of labels/pictures was handy.
Re: How to release mouse button when pressed on titlebar while form is disposing and reloading
All of this can be done without restarting the form. Any event can add controls to the form and they will be immediately available. No refresh is required.
Re: How to release mouse button when pressed on titlebar while form is disposing and reloading
Would you have the answer to my original question. How to ensure mouse is not pressed when the form first loads, or "reset" whatever state the mouse is in.
Re: How to release mouse button when pressed on titlebar while form is disposing and reloading
There is no way to turn off the mouse on a per-application basis.
Why would you think that you need to do this.
No controls will accept input until after the form is loaded. If you are running some other process after the form is loaded you can just disable controls that you don't want to send events.
Why would you think that you need to do this.
No controls will accept input until after the form is loaded. If you are running some other process after the form is loaded you can just disable controls that you don't want to send events.
Re: How to release mouse button when pressed on titlebar while form is disposing and reloading
If, at the time of when form.dispose() happens and new form loads a mouse is being pressed on the title-bar/minimize/close button area, the new form's title-bar will be unresponsive.
Re: How to release mouse button when pressed on titlebar while form is disposing and reloading
As I noted before. You do not need to "Dispose" of a form. You also cannot create a form from inside of a form that will be closed.
I recommend starting by reading what there is on forms programming is Windows. There are still a couple of books available from Wrox and there are many tutorials on MSDN.
Note that PowerShell cannot "Run" a form. Only "ShowDialog" is supported in a console application. Exiling from a form can only be done by either an explicit or implicit "Close".
"Run" and "Show" are not possible in a console application because there is not main window message loop and the code is not compiled with the form but is attached from the main PowerShell thread.
What is it that you are trying to accomplish? Why can you not use Forms as required by PS and the Framework?
I recommend starting by reading what there is on forms programming is Windows. There are still a couple of books available from Wrox and there are many tutorials on MSDN.
Note that PowerShell cannot "Run" a form. Only "ShowDialog" is supported in a console application. Exiling from a form can only be done by either an explicit or implicit "Close".
"Run" and "Show" are not possible in a console application because there is not main window message loop and the code is not compiled with the form but is attached from the main PowerShell thread.
What is it that you are trying to accomplish? Why can you not use Forms as required by PS and the Framework?