19 Şubat 2012, 18:29
|
#1 |
Çevrimdışı
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
| CheckBox
Bu forumdaki linkleri ve resimleri görebilmek için en az 25 mesajınız olması gerekir. C++/Cli ye güzel bir başlangıç temelden CheckBox (Onay Kutuları) kullanım. Kod: Kodu kopyalamak için üzerine çift tıklayın! #pragma once
namespace CheckBox1 {
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>
/// Summary for Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::CheckBox^ checkBox1;
protected:
private: System::Windows::Forms::CheckBox^ checkBox2;
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::CheckBox^ checkBox3;
private: System::Windows::Forms::Label^ label1;
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->checkBox1 = (gcnew System::Windows::Forms::CheckBox());
this->checkBox2 = (gcnew System::Windows::Forms::CheckBox());
this->button1 = (gcnew System::Windows::Forms::Button());
this->checkBox3 = (gcnew System::Windows::Forms::CheckBox());
this->label1 = (gcnew System::Windows::Forms::Label());
this->SuspendLayout();
//
// checkBox1
//
this->checkBox1->AutoSize = true;
this->checkBox1->Location = System::Drawing::Point(15, 13);
this->checkBox1->Name = L"checkBox1";
this->checkBox1->Size = System::Drawing::Size(80, 17);
this->checkBox1->TabIndex = 0;
this->checkBox1->Text = L"checkBox1";
this->checkBox1->UseVisualStyleBackColor = true;
//
// checkBox2
//
this->checkBox2->AutoSize = true;
this->checkBox2->Location = System::Drawing::Point(127, 13);
this->checkBox2->Name = L"checkBox2";
this->checkBox2->Size = System::Drawing::Size(80, 17);
this->checkBox2->TabIndex = 1;
this->checkBox2->Text = L"checkBox2";
this->checkBox2->UseVisualStyleBackColor = true;
//
// button1
//
this->button1->Location = System::Drawing::Point(253, 63);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 23);
this->button1->TabIndex = 2;
this->button1->Text = L"button1";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// checkBox3
//
this->checkBox3->AutoSize = true;
this->checkBox3->Location = System::Drawing::Point(248, 13);
this->checkBox3->Name = L"checkBox3";
this->checkBox3->Size = System::Drawing::Size(80, 17);
this->checkBox3->TabIndex = 3;
this->checkBox3->Text = L"checkBox3";
this->checkBox3->UseVisualStyleBackColor = true;
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(12, 44);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(35, 13);
this->label1->TabIndex = 4;
this->label1->Text = L"label1";
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(340, 98);
this->Controls->Add(this->label1);
this->Controls->Add(this->checkBox3);
this->Controls->Add(this->button1);
this->Controls->Add(this->checkBox2);
this->Controls->Add(this->checkBox1);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
//gerekli yerlere ilk yazılarını ekliyoruz.
label1->Text="İşlem için 1. ve 2. kutuyu dolu 3. kutunun ise boş kalması gerekiyor.";
button1->Text="Dene...";
checkBox1->Text="1. Kutu";
checkBox2->Text="2. Kutu";
checkBox3->Text="3. Kutu";
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
if(checkBox1->CheckState == CheckState::Checked)
{
//1. kutunun dolu olduğu anlama gelir...
if(checkBox2->CheckState == CheckState::Checked)
{
//2. kutunun dolu olduğu anlama gelir...
if(checkBox3->CheckState == CheckState::Unchecked)
{
//3. kutunun dolu olmadığı anlama gelir...
label1->Text="İşlem Yapldı. Teşekkürler...";
}
else
{
label1->Text="İşlem için 3. kutunun ise boş kalması gerekiyor.";
}
}
else
{
label1->Text="İşlem için 2. kutuyu dolu 3. kutunun ise boş kalması gerekiyor.";
}
}
else
{
label1->Text="İşlem için 1. ve 2. kutuyu dolu 3. kutunun ise boş kalması gerekiyor.";
}
}
};
}
__________________ Doğruları biliyorsan, yalanları dinlemek eğlencelidir. |
| |