Click to See Complete Forum and Search --> : Graphics decleration???


Markus1982
July 20th, 2005, 02:56 AM
Hello together!

I have the following problem.

I want to draw and I cannot create Graphics and Pens

Graphics* graph
Pen* pen

The mistake message:

Indirektion with * not possible.

What can I do to draw?

Darka
July 20th, 2005, 03:09 AM
Please post your code.

Markus1982
July 20th, 2005, 03:12 AM
I don't have my code here now I will post it later.

Markus1982
July 20th, 2005, 03:15 AM
But I just created a new C++ Project and then wanted to declerate a Graphics object with * (indirect).

And that doesn't work

Markus1982
July 21st, 2005, 02:01 PM
#pragma once


namespace TicTacToe
{
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

public ref class 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>
virtual void 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 if you have an idea how to prevent that mistake