[VC++] Getting mouse position
-
I am a year 1 engineering student and is quite new to programming. Just learnt the very basics of C++ like looping, pointer, array (not even inheritence, etc). Recently I was taught about windows form application, and yet I only know about double-click on button to add some codes in the event-handler upon clicking, and MessageBox::Show(). I will learn some GDI+ and will be required to display some images moving in the form. If I want to develop a dummy gun game, in which a bullet will be displayed upon clicking (using GDI+), I will need to get the current position of the mouse upon clicking. I looked up the msdn and other search engines but just couldn't understand what class or object or function I should use for this purpose. I could only find something like: public: MouseEventArgs(MouseButtons Button, int Clicks, int X, int Y, int Delta); But I don't know where I should put it in, and how I can get access to the position X and Y. I would like the whole form to be possible for mouse-clicking without any button. Can someone help me?
-
I am a year 1 engineering student and is quite new to programming. Just learnt the very basics of C++ like looping, pointer, array (not even inheritence, etc). Recently I was taught about windows form application, and yet I only know about double-click on button to add some codes in the event-handler upon clicking, and MessageBox::Show(). I will learn some GDI+ and will be required to display some images moving in the form. If I want to develop a dummy gun game, in which a bullet will be displayed upon clicking (using GDI+), I will need to get the current position of the mouse upon clicking. I looked up the msdn and other search engines but just couldn't understand what class or object or function I should use for this purpose. I could only find something like: public: MouseEventArgs(MouseButtons Button, int Clicks, int X, int Y, int Delta); But I don't know where I should put it in, and how I can get access to the position X and Y. I would like the whole form to be possible for mouse-clicking without any button. Can someone help me?
The MouseEventHandler[^] delegate should provide what you want.
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman