Change form's cursor in a static member function
I need to change the cursor in a static member function but I receive a compiler error
error C2671 : static member functions do not have 'this' pointers
this->Cursor = System::Windows::Forms::Cursors::Default;
How do I modify the code so it will work in a static member function?
Thanks.
DotNetUser
Junior Poster in Training
69 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
you cannot access class objects/methods from class static methods. There are at least two ways to overcome this:
1. pass a pointer or reference of an instance of the object to the static method, then access the objects through this pointer/reference.
2. make the object(s) static.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
Since I am changing the cursor on the form itself, the form's object is not visible to make it static.
DotNetUser
Junior Poster in Training
69 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0