| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Managed C++ and C++/CLI Discuss Managed C++ and .NET-specific questions related to C++. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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? |
|
#2
|
|||
|
|||
|
Re: Graphics decleration???
Please post your code.
|
|
#3
|
|||
|
|||
|
Re: Graphics decleration???
I don't have my code here now I will post it later.
|
|
#4
|
|||
|
|||
|
Re: Graphics decleration???
But I just created a new C++ Project and then wanted to declerate a Graphics object with * (indirect).
And that doesn't work |
|
#5
|
|||
|
|||
|
Re: Graphics decleration???
Code:
#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
};
}
Last edited by Andy Tacker; July 22nd, 2005 at 05:37 AM. |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|