ラジオボタンです。
1つのグループの中で、1つしか選択できません。
基本プロジェクトにラジオボタンを3つ配置します。
ビルドして実行してみましょう。
MyForm.cpp
#pragma comment(linker, "/SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup")
#include "MyForm.h"
using namespace Project1;
[STAThreadAttribute]
int main(){
MyForm ^form1 = gcnew MyForm;
form1->ShowDialog();
return 0;
}
|
MyForm.h
#pragma once
namespace Project1 {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// MyForm の概要
/// </summary>
public ref class MyForm : public System::Windows::Forms::Form
{
public:
MyForm(void)
{
InitializeComponent();
//
//TODO: ここにコンストラクター コードを追加します
//
}
protected:
/// <summary>
/// 使用中のリソースをすべてクリーンアップします。
/// </summary>
~MyForm()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::RadioButton^ radioButton1;
protected:
private: System::Windows::Forms::RadioButton^ radioButton2;
private: System::Windows::Forms::RadioButton^ radioButton3;
protected:
protected:
private:
/// <summary>
/// 必要なデザイナー変数です。
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// デザイナー サポートに必要なメソッドです。このメソッドの内容を
/// コード エディターで変更しないでください。
/// </summary>
void InitializeComponent(void)
{
this->radioButton1 = (gcnew System::Windows::Forms::RadioButton());
this->radioButton2 = (gcnew System::Windows::Forms::RadioButton());
this->radioButton3 = (gcnew System::Windows::Forms::RadioButton());
this->SuspendLayout();
//
// radioButton1
//
this->radioButton1->AutoSize = true;
this->radioButton1->Location = System::Drawing::Point(93, 51);
this->radioButton1->Name = L"radioButton1";
this->radioButton1->Size = System::Drawing::Size(88, 16);
this->radioButton1->TabIndex = 0;
this->radioButton1->TabStop = true;
this->radioButton1->Text = L"radioButton1";
this->radioButton1->UseVisualStyleBackColor = true;
//
// radioButton2
//
this->radioButton2->AutoSize = true;
this->radioButton2->Location = System::Drawing::Point(93, 83);
this->radioButton2->Name = L"radioButton2";
this->radioButton2->Size = System::Drawing::Size(88, 16);
this->radioButton2->TabIndex = 1;
this->radioButton2->TabStop = true;
this->radioButton2->Text = L"radioButton2";
this->radioButton2->UseVisualStyleBackColor = true;
//
// radioButton3
//
this->radioButton3->AutoSize = true;
this->radioButton3->Location = System::Drawing::Point(93, 115);
this->radioButton3->Name = L"radioButton3";
this->radioButton3->Size = System::Drawing::Size(88, 16);
this->radioButton3->TabIndex = 2;
this->radioButton3->TabStop = true;
this->radioButton3->Text = L"radioButton3";
this->radioButton3->UseVisualStyleBackColor = true;
//
// MyForm
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(284, 261);
this->Controls->Add(this->radioButton3);
this->Controls->Add(this->radioButton2);
this->Controls->Add(this->radioButton1);
this->Name = L"MyForm";
this->Text = L"Hello C++/CLI World !!";
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
};
}
|
最終更新:2013年09月15日 21:11