|
Visual C++ 32 razryadli takomillashtirilgan vizual komponentalar kutubxonasi VCL
|
bet | 2/2 | Sana | 21.05.2024 | Hajmi | 0,81 Mb. | | #247953 |
Bog'liq dasturlash3Visual C++ 32 razryadli takomillashtirilgan vizual komponentalar kutubxonasi VCL (Visual Component Library) bilan birgalikda etkazib beriladi. Bu kutubxona eng murakkab ilovalarni qurish uchun mo’ljallangan, 100 dan ortiq takroran qo’llanadigan komponentalardan iborat. Kutubxonaning asosiy komponentalari - Palitra komponentalarining instrumental panelida berilgan. Komponentalar belgilari dastur formasiga olib o’tiladi.
MainForm.h filiga kiramiz dastur yozilishidan oldingi holati
Dasturimizning text, button larni joylashtiramiz va ularning text qismilarini shiriftlarini to’g’irlaymiz va dasturning backColor bo’limidan orqa fonga rang beramz
Xususiyatlar “Properties” va hodisalar “Events” oynasi.
Ushbu oyna orqali komponentalarning tashqi ko’rinishlari va barcha xususiyatlari sozlanadi. Misol uchun komponentaning o’lchamini o’zgartirish kerak bo’lsa, Font qismidagi 3 ta nuqtali tugma bosiladi va komponenta o’lchamlari o’rnatiladi.
#pragma once
namespace FirstCppProject {
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 for MainForm
///
public ref class MainForm : public System::Windows::Forms::Form
{
public:
MainForm(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
///
/// Clean up any resources being used.
///
~MainForm()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::TextBox^ tbFirstName;
private: System::Windows::Forms::TextBox^ tbLastName;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ lbWelcome;
private: System::Windows::Forms::TableLayoutPanel^ tableLayoutPanel1;
private: System::Windows::Forms::Button^ OkButton;
private: System::Windows::Forms::Button^ ClearButton;
protected:
private:
///
/// Required designer variable.
///
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
void InitializeComponent(void)
{
this->label1 = (gcnew System::Windows::Forms::Label());
this->tbFirstName = (gcnew System::Windows::Forms::TextBox());
this->tbLastName = (gcnew System::Windows::Forms::TextBox());
this->label2 = (gcnew System::Windows::Forms::Label());
this->lbWelcome = (gcnew System::Windows::Forms::Label());
this->tableLayoutPanel1 = (gcnew System::Windows::Forms::TableLayoutPanel());
this->OkButton = (gcnew System::Windows::Forms::Button());
this->ClearButton = (gcnew System::Windows::Forms::Button());
this->tableLayoutPanel1->SuspendLayout();
this->SuspendLayout();
//
// label1
//
this->label1->AutoSize = true;
this->label1->Font = (gcnew System::Drawing::Font(L"Segoe Print", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->label1->Location = System::Drawing::Point(12, 9);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(118, 35);
this->label1->TabIndex = 0;
this->label1->Text = L"first name";
this->label1->Click += gcnew System::EventHandler(this, &MainForm::label1_Click);
//
// tbFirstName
//
this->tbFirstName->Anchor = static_cast(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left)
| System::Windows::Forms::AnchorStyles::Right));
this->tbFirstName->Font = (gcnew System::Drawing::Font(L"Segoe Print", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->tbFirstName->Location = System::Drawing::Point(18, 57);
this->tbFirstName->Name = L"tbFirstName";
this->tbFirstName->Size = System::Drawing::Size(403, 43);
this->tbFirstName->TabIndex = 1;
this->tbFirstName->TextChanged += gcnew System::EventHandler(this, &MainForm::textBox1_TextChanged);
//
// tbLastName
//
this->tbLastName->Anchor = static_cast(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left)
| System::Windows::Forms::AnchorStyles::Right));
this->tbLastName->Font = (gcnew System::Drawing::Font(L"Segoe Print", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->tbLastName->Location = System::Drawing::Point(18, 195);
this->tbLastName->Name = L"tbLastName";
this->tbLastName->Size = System::Drawing::Size(403, 43);
this->tbLastName->TabIndex = 3;
this->tbLastName->TextChanged += gcnew System::EventHandler(this, &MainForm::textBox2_TextChanged);
//
// label2
//
this->label2->AutoSize = true;
this->label2->Font = (gcnew System::Drawing::Font(L"Segoe Print", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->label2->Location = System::Drawing::Point(12, 147);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(113, 35);
this->label2->TabIndex = 2;
this->label2->Text = L"last name";
this->label2->Click += gcnew System::EventHandler(this, &MainForm::label2_Click);
//
// lbWelcome
//
this->lbWelcome->AutoSize = true;
this->lbWelcome->Font = (gcnew System::Drawing::Font(L"Segoe Print", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->lbWelcome->Location = System::Drawing::Point(25, 267);
this->lbWelcome->Name = L"lbWelcome";
this->lbWelcome->Size = System::Drawing::Size(35, 35);
this->lbWelcome->TabIndex = 4;
this->lbWelcome->Text = L"....";
//
// tableLayoutPanel1
//
this->tableLayoutPanel1->Anchor = static_cast(((System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left)
| System::Windows::Forms::AnchorStyles::Right));
this->tableLayoutPanel1->ColumnCount = 2;
this->tableLayoutPanel1->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle(System::Windows::Forms::SizeType::Percent,
50)));
this->tableLayoutPanel1->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle(System::Windows::Forms::SizeType::Percent,
50)));
this->tableLayoutPanel1->Controls->Add(this->OkButton, 0, 0);
this->tableLayoutPanel1->Controls->Add(this->ClearButton, 1, 0);
this->tableLayoutPanel1->Location = System::Drawing::Point(12, 346);
this->tableLayoutPanel1->Name = L"tableLayoutPanel1";
this->tableLayoutPanel1->RowCount = 1;
this->tableLayoutPanel1->RowStyles->Add((gcnew System::Windows::Forms::RowStyle(System::Windows::Forms::SizeType::Percent, 50)));
this->tableLayoutPanel1->Size = System::Drawing::Size(392, 76);
this->tableLayoutPanel1->TabIndex = 5;
//
// OkButton
//
this->OkButton->Anchor = static_cast(((System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left)
| System::Windows::Forms::AnchorStyles::Right));
this->OkButton->Font = (gcnew System::Drawing::Font(L"Segoe Print", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->OkButton->Location = System::Drawing::Point(3, 6);
this->OkButton->Name = L"OkButton";
this->OkButton->Size = System::Drawing::Size(190, 67);
this->OkButton->TabIndex = 0;
this->OkButton->Text = L"OK";
this->OkButton->UseVisualStyleBackColor = true;
this->OkButton->Click += gcnew System::EventHandler(this, &MainForm::button1_Click);
//
// ClearButton
//
this->ClearButton->Anchor = static_cast(((System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left)
| System::Windows::Forms::AnchorStyles::Right));
this->ClearButton->Font = (gcnew System::Drawing::Font(L"Segoe Print", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->ClearButton->Location = System::Drawing::Point(199, 6);
this->ClearButton->Name = L"ClearButton";
this->ClearButton->Size = System::Drawing::Size(190, 67);
this->ClearButton->TabIndex = 1;
this->ClearButton->Text = L"CLEAR";
this->ClearButton->UseVisualStyleBackColor = true;
this->ClearButton->Click += gcnew System::EventHandler(this, &MainForm::ClearButton_Click);
//
// MainForm
//
this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->BackColor = System::Drawing::Color::FromArgb(static_cast(static_cast(128)), static_cast(static_cast(128)),
static_cast(static_cast(255)));
this->ClientSize = System::Drawing::Size(433, 450);
this->Controls->Add(this->tableLayoutPanel1);
this->Controls->Add(this->lbWelcome);
this->Controls->Add(this->tbLastName);
this->Controls->Add(this->label2);
this->Controls->Add(this->tbFirstName);
this->Controls->Add(this->label1);
this->MinimumSize = System::Drawing::Size(417, 497);
this->Name = L"MainForm";
this->Text = L"Sardor Toirov dasturiy injinering 082-22";
this->Load += gcnew System::EventHandler(this, &MainForm::MainForm_Load);
this->tableLayoutPanel1->ResumeLayout(false);
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void MainForm_Load(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void label2_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void textBox2_TextChanged(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
String^ firstName = this->tbFirstName->Text;
String^ lastName = this->tbLastName->Text;
this->lbWelcome->Text = "Hello " + firstName + " " + lastName;
}
private: System::Void ClearButton_Click(System::Object^ sender, System::EventArgs^ e) {
this->tbFirstName->Text = "";
this->tbLastName->Text = "";
this->lbWelcome->Text = "";
}
private: System::Void MainForm_Load(System::Object^ sender, System::EventArgs^ e) {
this->lbWelcome->Text = "";
}
};
}
Dastur natijasi:
|
| |