Here's what I use:
{code}
using System.Windows.Forms;
using Autodesk.AutoCAD.Runtime;
namespace MyNamespace
{
public class CurrentCursor : IDisposable
{
private Cursor saved = Cursor.Current;
public CurrentCursor( Cursor newCursor )
{
Cursor.Current = newCursor;
}
public void Dispose()
{
Cursor.Current = this.saved;
}
}
public class WaitCursor : CurrentCursor
{
public WaitCursor()
: base( Cursors.WaitCursor )
{
}
}
// example usage:
public class MyCommands
{
[CommandMethod("MYCOMMAND")
public static void MyCommand()
{
using( new WaitCursor() )
{
// wait cursor is visible here,
// so do what you need to do
} // the prevous cursor is restored here.
}
}
}
{code}
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010
http://www.acadxtabs.com
Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");
"Hericson" wrote in message
news:6237315@discussion.autodesk.com...
Tony Tanzillo wrote:
> You can reference System.Windows.Forms from any app,
> even if it doesn't use any forms or UI components.
>
> If for some reason you need to avoid referencing WinForms,
> the only other option is P/Invoking the SetCursor() API
>
Can you give an example with the correct namespace because when I try
with: System.Windows.Forms.Cursor = Cursors.WaitCursor I'll get an error
message: 'Cursor' is an type in 'Forms' and cannot be use as an expression.
If I have a form I just have this code: Me.Cursor = Cursors.WaitCursor