0

I'm following this tutorial cursor tutorial , but when i copy +paste the code in my c# desktop application and on building the app follwoing error is given

error CS0103: The name 'Mouse' does not exist in the current context

any idea on this error? I've search for the class "Mouse" and it is there in C# Mouse Class

1
  • Perhaps you can post code and if this is WPF or WinForms... Mar 14, 2012 at 16:16

5 Answers 5

3

Are u sure u did the following :

1: In the soulution explorer added the reference PresentationCore.dll (Under the tab COM)

2: Added "using System.Windows.Input;" at the top of the current file

0
2

The mentioned System.Windows.Input namespace is part of Windows Presentation Foundation, not Windows Forms. Maybe you started with the wrong Visual Studio Project template?

1

There's a Mouse class in Microsoft.VisualBasic.Devices as well - I suspect they copied and pasted that bit of their code from their VB example on the same page.

1

I believe in WinForms you can implement the same logic using the Cursor.Current instead of WPF-specific Mouse.OverrideCursor.

Links:

1

The link you posted to the tutorial shows a WPF application, not a winforms.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.