Delen via


WaitCursor Class

Displays the Wait cursor while an instance exists, and restores the original cursor when it is disposed.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Modeling.Shell.WaitCursor

Namespace:  Microsoft.VisualStudio.Modeling.Shell
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.Shell.12.0 (in Microsoft.VisualStudio.Modeling.Sdk.Shell.12.0.dll)

Syntax

'Declaration
Public NotInheritable Class WaitCursor _
    Implements IDisposable
public sealed class WaitCursor : IDisposable
public ref class WaitCursor sealed : IDisposable
[<Sealed>]
type WaitCursor =  
    class 
        interface IDisposable 
    end
public final class WaitCursor implements IDisposable

The WaitCursor type exposes the following members.

Constructors

  Name Description
Public method WaitCursor Stores the current cursor and displays the wait cursor whenever the mouse pointer is over the specified user interface control. When the instance is disposed, the current cursor will be restored.

Top

Methods

  Name Description
Public method Clear Restore the original cursor. It is not normally necessary to call this explicitly.
Public method Dispose Restore the original cursor. This happens automatically at the end of a using block.
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Finalize Ensure that the cursor is cleared when the object is disposed. (Overrides Object.Finalize().)
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

This class is designed to be used with the 'using' statement. In the following example, the wait cursor will be displayed while the enclosed block is being executed, whenever the mouse is over the specified control.

Examples

using (WaitCursor w = new WaitCursor(control)) 
{/* wait cursor displayed over control while execution is in here */}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.VisualStudio.Modeling.Shell Namespace