|
||||||
| C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
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;
}
}
Thanks -Jill |
| Sponsored Links |
|
|
|
|||
|
Could you post the error message it gives you with the line after the if statement? I think it might be because you don't have #using namespace System; near the beginning of your code.
|
|
|||
|
Nevermind, I figured out my issue (i was doing "createGraphics" instead of "createGraphics()"). thanks guys, appreciate the help and I'll probably have more things to ask in the future
![]() |
|
|||||
|
No probs.
In older versions of VB and things you could get away with not using () but in .NET it is mandatory. |
| Sponsored Links |
|
|
|
|||
|
There's a newer version available for download on Microsoft's website (free):
Microsoft Visual Studio 2008 |
|
|||||
|
I can't see much difference between versions 2005 and 2008.
|
|
|||
|
I've never had the 2005 version, so I wouldn't know.
|
|
|||||
|
I have. I really can't see the difference between them.
|
![]() |
| Tags |
| c++, graphics, gui, java, visual |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Visual Studio 2005 and Windows Vista | Jordan | General Programming | 3 | 01-22-2007 03:21 PM |
| Visual Studio 2005 Pro Won't Install | CheeseBurgerMan | Software Development Tools | 10 | 09-22-2006 05:44 PM |
| Visual Studio 2005 Express Edition | Crane | Software Development Tools | 9 | 05-25-2006 06:17 PM |
| Visual Studio 2005 Free Training | Crane | C and C++ | 6 | 05-23-2006 11:55 PM |
| John | ........ | 223.00000 |
| dargueta | ........ | 168.00000 |
| Xav | ........ | 164.00000 |
| LogicKills | ........ | 20.00000 |
| gaylo565 | ........ | 18.00000 |
| WingedPanther | ........ | 15.00000 |
| |pH| | ........ | 15.00000 |
| Johnnyboy | ........ | 3.00000 |
| navghost | ........ | 1.00000 |
Goal: 100,000 Posts
Complete: 67%