掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
線を引くには? (ID:69591)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
みなさん、貴重なご意見、ありがとうございました。 以下のようにグラフ表示ボタンを押下すると、GraphShowウィンドウが表示され、そこに線を引きたいのですが、エラーとなってしまいます。 何が原因なのでしょうか? ご教示よろしくお願い致します。 #pragma once namespace test000000 { 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: System::Windows::Forms::Button^ ButtonGraph; public: Form1(void) { InitializeComponent(); } protected: ~Form1() { if (components) { delete components; } } private: System::Windows::Forms::Button^ button1; protected: private: System::ComponentModel::Container ^components; #pragma region Windows Form Designer generated code void InitializeComponent(void) { this->button1 = (gcnew System::Windows::Forms::Button()); this->SuspendLayout(); // button1 this->button1->Location = System::Drawing::Point(98, 100); this->button1->Name = L"button1"; this->button1->Size = System::Drawing::Size(75, 23); this->button1->TabIndex = 0; this->button1->Text = L"グラフ表示"; this->button1->UseVisualStyleBackColor = true; this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click); // Form1 this->AutoScaleDimensions = System::Drawing::SizeF(6, 12); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(292, 266); this->Controls->Add(this->button1); this->Name = L"Form1"; this->Text = L"Form1"; this->ResumeLayout(false); } #pragma endregion //グラフ表示ボタン押下 private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { System::Windows::Forms::Form^ Form2 = gcnew Form; ButtonGraph = gcnew System::Windows::Forms::Button(); ButtonGraph->Parent = Form2; ButtonGraph->Width = 50; ButtonGraph->Location = System::Drawing::Point(230, 54); ButtonGraph->Name = L"ButtonGraph"; ButtonGraph->Size = System::Drawing::Size(50, 23); ButtonGraph->Text = L"グラフ表示"; ButtonGraph->UseVisualStyleBackColor = true; ButtonGraph->Click += gcnew System::EventHandler(this, &Form1::ButtonGraph_Click); Form2->ShowIcon = false; Form2->MinimizeBox = false; Form2->MaximizeBox = false; Form2->Text = L"GrapthShow"; Form2->Width = 200; Form2->Height = 200; Form2->MinimumSize = System::Drawing::Size(200,200); Form2->MaximumSize = System::Drawing::Size(200,200); Form2->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen; Form2->Activate(); Form2->Show(); Form2->Refresh(); } private: System::Void ButtonGraph_Click(System::Object^ sender, System::EventArgs^ e) { System::Drawing::Pen^ redPen = gcnew Pen( Color::Red ); System::Drawing::Graphics::DrawLine(redPen,10,10,100,100); } }; }
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.