How to make mouse cursor busy [not in main form]

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
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.
This topic is 10 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
riteshparab
Posts: 2
Last visit: Thu Oct 17, 2013 6:15 am

How to make mouse cursor busy [not in main form]

Post by riteshparab »

How to make active mouse cursor busy [not in main form] while application is loading. . .

I have tries [system.windows.input] but no luck :(

-RP
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: How to make mouse cursor busy [not in main form]

Post by davidc »

Each control and form has a Cursor property. Simply set it to Busy:
PowerShell Code
Double-click the code block to select all.
$form1.Cursor = 'WaitCursor'
David
David
SAPIEN Technologies, Inc.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: How to make mouse cursor busy [not in main form]

Post by davidc »

You could try the following if there is no visible form or control:
PowerShell Code
Double-click the code block to select all.
[System.Windows.Forms.Cursor]::Current = 'WaitCursor'
PowerShell Code
Double-click the code block to select all.
[System.Windows.Forms.Application]::UseWaitCursor = $true
David
David
SAPIEN Technologies, Inc.
User avatar
riteshparab
Posts: 2
Last visit: Thu Oct 17, 2013 6:15 am

Re: How to make mouse cursor busy [not in main form]

Post by riteshparab »

Hi David,

Thx for your reply.

I have created a GUI, and it's takes some time to load the exe file {and it's forms, as functions are loading} . . . I want to set users active mouse cursor to busy. (users are confused and they check the task manager as nothing is displayed on the screen that time).

Here is the small snap, hope you don;t mind.
http://www.youtube.com/watch?v=3V8MpxXSmf4


Again thx for your time.

-RP
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: How to make mouse cursor busy [not in main form]

Post by jvierra »

Your video shows an error and nothing else.

When we design a form or application we try to NOT run things in the "OnLoad" procedure. One way to do long running initializations is to load the main form and either ask the user to click to start or display the for m the launch a small dialog that loads the data while displaying a message (Please wait while we load"
User avatar
jessepit
Posts: 3
Last visit: Thu Oct 17, 2013 10:56 pm

Re: How to make mouse cursor busy [not in main form]

Post by jessepit »

Thanks for this awesome thread. This information will come in handy. :)
This topic is 10 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked