View Single Post
  #1 (permalink)  
Old 07-07-2008, 03:48 AM
hellochar hellochar is offline
Newbie
 
Join Date: Jul 2008
Posts: 10
Rep Power: 0
hellochar is on a distinguished road
Question Visual C++ 2005 giving me a hard time

Hi, I've been a Java programmer for 2-3 years now, and over the summer I am trying to learn C++. I hear they're basically the same thing, and I've gone through some online tutorials and the like. The problem I have today is one with Windows Forms. For those of you who know Java, it's easy enough to make something graphical. My first attempt at a real program in Java was a simple program where you drew with your mouse, so I'm doing the same for C++. But I have a problem. With Java, it's easy enough to make a "Form" by creating a JFrame and retrieving a Graphics object. But in C++ I have no idea how to do that, and I'm getting lost in Visual C++ 2005 express edition. I don't usually like to use the GUI builders, so I'm attempting to avoid that, but I can't seem to get a window to show in C++ without the builder... can anyone help me?

Right now, through using the builder, I can create a method that fires off when the mouse moves.

Code:
private: System::Void mouseMoved(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
				 if( e->Button == System::Windows::Forms::MouseButtons::Left) {
					 System::Drawing::Graphics g = this->CreateGraphics;
				}
			 }
I have some questions about the code:
  • What is sender?
  • The compiler gives me errors when I try to compile the line after the if statement. I know I'm doing something wrong with pointers, can someone tell me the problem and possibly a solution?

Thanks

-Jill
Reply With Quote

Sponsored Links