掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
新ウィンドウの消去について (ID:69490)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
Form2->Close();とし、フォームを閉じようと以下の記述をしましたが、 ボタンを押下してもForm2->Close();でブレイクが止まりません。 何故でしょうか? #pragma once namespace My777 { 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 { public: Form1(void) { InitializeComponent(); } protected: ~Form1() { if (components) { delete components; } } private: System::Windows::Forms::Button^ button1; private: System::Windows::Forms::Button^ ButtonXXX; protected: private: System::ComponentModel::Container ^components; private: System::Windows::Forms::Form^ Form2; #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(93, 93); this->button1->Name = L"button1"; this->button1->Size = System::Drawing::Size(102, 45); this->button1->TabIndex = 0; this->button1->Text = L"button1"; 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); this->Form2 = (gcnew System::Windows::Forms::Form()); } #pragma endregion //button1が押下された private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { ButtonXXX = gcnew System::Windows::Forms::Button(); ButtonXXX->Parent = Form2; ButtonXXX->AutoSize = true; ButtonXXX->Width = 250; ButtonXXX->Location = System::Drawing::Point(10,30); ButtonXXX->ForeColor = System::Drawing::Color::Black; ButtonXXX->Name = L"ButtonXXX"; ButtonXXX->Size = System::Drawing::Size(5, 12); ButtonXXX->Text = L"ボタン"; Form2->Text = L"test"; Form2->Width = 315; Form2->Height = 145; Form2->MinimumSize = System::Drawing::Size(315,145); Form2->MaximumSize = System::Drawing::Size(315,145); Form2->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen; Form2->Activate(); Form2->Show(); Form2->Refresh(); } //ボタンが押下された private: System::Void ButtonXXX_Click(System::Object^ sender, System::EventArgs^ e) { //新ウィンドウを消去する。 Form2->Close(); } }; }
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.