Graphics* graph; doesn't work
I just opened a project in Visual Studio 2005 beta 2(c++) and I want to draw, but I cannot declerate Graphics and Pen.
My code:
#pragmaonce
namespace TicTacToe
{
usingnamespace System;
usingnamespace System::ComponentModel;
usingnamespace System::Collections;
usingnamespace System::Windows::Forms;
usingnamespace System::Data;
usingnamespace System::Drawing;
publicrefclass Form1 :public System::Windows::Forms::Form
{
private:
Graphics* graph;
Pen* pen;
public:
Form1(void)
{
InitializeComponent();
graph=this->CreateGraphics();
pen=gcnew Pen(Color::Black);
graph->DrawLine(pen, 20,20, 100, 200);
}
protected:
///<summary>
/// Clean up any resources being used.///</summary>///<param name="disposing">"description of the parameter"</param>virtualvoid Dispose(Boolean disposing)override{
if (disposing && components){
delete components;}
__super::Dispose(disposing);}
private:///<summary>/// Required designer variable.///</summary>System::ComponentModel::Container ^components;
#pragma
region Windows Form Designer generated code///<summary>/// Required method for Designer support - do not modify/// the contents of this method with the code editor.///</summary>void InitializeComponent(void){
this->components =gcnew System::ComponentModel::Container();this->Size = System::Drawing::Size(300,300);this->Text = L"Form1";this->Padding = System::Windows::Forms::Padding(0);this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;}
#pragma
endregion};
}
Pls let me know what is wrong or which settings I have to chance.
The error messages are:
Error 1 error C3699: '*' : cannot use this indirection on type 'System::Drawing::Graphics' c:\markus\spiele\tic tac toe\tic tac toe\Form1.h 16
Error 2 error C3699: '*' : cannot use this indirection on type 'System::Drawing::Pen' c:\markus\spiele\tic tac toe\tic tac toe\Form1.h 17

