CheckBox demo : CheckBox « GUI Form « Visual C++ .NET

Home
Visual C++ .NET
1.2D
2.Class
3.Collections
4.Data Type
5.Database ADO.net
6.Delegate
7.Development
8.File Directory
9.Function
10.Generics
11.GUI Form
12.Language Basics
13.Network
14.Reflection
15.Security
16.Statement
17.Structure
18.Thread
19.XML
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Visual C++ .NET » GUI Form » CheckBox 
CheckBox demo
 

int main(array<System::String ^> ^args)
{
  Application::Run(gcnew Form1());
  return 0;
}



  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();

    }



  private:
        System::Windows::Forms::CheckBox^  BottomCheck;
        System::Windows::Forms::CheckBox^  checkBox2;
        System::Windows::Forms::CheckBox^  checkBox1;
        System::Windows::Forms::CheckBox^  TopCheck;


    void InitializeComponent(void)
    {
            this->BottomCheck = (gcnew System::Windows::Forms::CheckBox());
            this->checkBox2 = (gcnew System::Windows::Forms::CheckBox());
            this->checkBox1 = (gcnew System::Windows::Forms::CheckBox());
            this->TopCheck = (gcnew System::Windows::Forms::CheckBox());
            this->SuspendLayout();
            // 
            // BottomCheck

            // 
            this->BottomCheck->AutoSize = true;
            this->BottomCheck->Enabled = false;
            this->BottomCheck->Location = System::Drawing::Point(52167);
            this->BottomCheck->Name = L"BottomCheck";
            this->BottomCheck->Size = System::Drawing::Size(12717);
            this->BottomCheck->TabIndex = 4;
            this->BottomCheck->TabStop = false;
            this->BottomCheck->Text = L"You Can\'t Check Me!";
            this->BottomCheck->Visible = false;
            this->BottomCheck->Enter += 
                gcnew System::EventHandler(this, &Form1::BottomCheck_Enter);
            this->BottomCheck->MouseEnter += 
                gcnew System::EventHandler(this, &Form1::BottomCheck_Enter);
            // 
            // checkBox2
            // 
            this->checkBox2->AutoSize = true;
            this->checkBox2->Location = System::Drawing::Point(52130);
            this->checkBox2->Name = L"checkBox2";
            this->checkBox2->Size = System::Drawing::Size(10617);
            this->checkBox2->TabIndex = 5;
            this->checkBox2->Text = L"Don\'t Forget ME!";
            // 
            // checkBox1
            // 
            this->checkBox1->AutoSize = true;
            this->checkBox1->Checked = true;
            this->checkBox1->CheckState = 
                System::Windows::Forms::CheckState::Indeterminate;
            this->checkBox1->Location = System::Drawing::Point(5290);
            this->checkBox1->Name = L"checkBox1";
            this->checkBox1->Size = System::Drawing::Size(13317);
            this->checkBox1->TabIndex = 2;
            this->checkBox1->Text = L"Check Me! Check Me!";
            this->checkBox1->ThreeState = true;
            // 
            // TopCheck
            // 
            this->TopCheck->AutoSize = true;
            this->TopCheck->Location = System::Drawing::Point(5249);
            this->TopCheck->Name = L"TopCheck";
            this->TopCheck->Size = System::Drawing::Size(12717);
            this->TopCheck->TabIndex = 3;
            this->TopCheck->TabStop = false;
            this->TopCheck->Text = L"You Can\'t Check Me!";
            this->TopCheck->Enter += 
                gcnew System::EventHandler(this, &Form1::TopCheck_Enter);
            this->TopCheck->MouseEnter += 
                gcnew System::EventHandler(this, &Form1::TopCheck_Enter);

            // 
            // Form1
            // 
            this->AutoScaleDimensions = System::Drawing::SizeF(613);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this->ClientSize = System::Drawing::Size(242273);
            this->Controls->Add(this->BottomCheck);
            this->Controls->Add(this->checkBox2);
            this->Controls->Add(this->checkBox1);
            this->Controls->Add(this->TopCheck);
            this->Name = L"Form1";
            this->Text = L"Can\'t Check Me";
            this->ResumeLayout(false);
            this->PerformLayout();
    }

    private
        System::Void TopCheck_Enter(System::Object^ sender, System::EventArgs^ e)
        {
            // Hide Top checkbox and display bottom
            TopCheck->Enabled = false
            TopCheck->Visible = false
            BottomCheck->Enabled = true
            BottomCheck->Visible = true
        }

    private
        System::Void BottomCheck_Enter(System::Object^  sender, System::EventArgs^  e)
        {
            // Hide Bottom checkbox and display top
            BottomCheck->Enabled = false
            BottomCheck->Visible = false
            TopCheck->Enabled = true
            TopCheck->Visible = true
        }
  };

   
  
Related examples in the same category
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.