Visual C++ Forma muxitida ixtiyoriy dastur tuzish


TextBox komponentasi TtextBox



Download 233,09 Kb.
bet2/2
Sana16.06.2022
Hajmi233,09 Kb.
#677688
1   2
Bog'liq
Ishkobilov A.

TextBox komponentasi TtextBox sinfining to’g’ridan-to’g’ri hosilasi bo’lib, uning barcha xususiyatlari, metodlari va voqealariga vorislik qiladi.


Button

Yozuvli to’rtburchak tugmani yaratadi. Tugmacha bosilganda, dasturda biror-bir hatti-harakat nomlanadi (initstiallashtiriladi).


Tugmachalar ko’proq dialogli darchalarda qo’llanadi. Default xususiyatining true qiymati tomonidan tanlab olingan yashirin tugmacha, dialog darchasida har gal enter klavishasi bosilganda OnClick voqea qayta ishlatgichini ishga tushiradi. Cancel xususiyatining true qiymati tanlab olgan bekor qilish tugmachasi, dialog darchasida har gal Escape klavishasi bosilganda, OnClick voqea qayta ishlatgichini ishga tushiradi.




Masala Kvadrat tenglama ildizlarini topish dasturi
Dastur kodi


#pragma once


#include "iostream"


#include "conio.h"


#include "stdlib.h"


#include "math.h"


namespace WindowsFormsApplication3 {


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 Form1






public ref class Form1 : public System::Windows::Forms::Form {




public:

Form1(void)


{

InitializeComponent();


//


//TODO: Add the constructor code here


//

}



protected:








  • Clean up any resources being used.






~Form1()

{


if (components)

{

delete components;

}



}


private: System::Windows::Forms::Button^ button1;


private: System::Windows::Forms::TextBox^ textBox1;


private: System::Windows::Forms::TextBox^ textBox2;


private: System::Windows::Forms::TextBox^ textBox3;


private: System::Windows::Forms::Label^ label1;


private: System::Windows::Forms::Label^ label2;


private: System::Windows::Forms::Label^ label3;


private: System::Windows::Forms::Label^ label4;


private: System::Windows::Forms::Label^ label5;


private: System::Windows::Forms::Label^ label6;


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->button1 = (gcnew System::Windows::Forms::Button());


this->textBox1 = (gcnew System::Windows::Forms::TextBox());


this->textBox2 = (gcnew System::Windows::Forms::TextBox());


this->textBox3 = (gcnew System::Windows::Forms::TextBox());


this->label1 = (gcnew System::Windows::Forms::Label());


this->label2 = (gcnew System::Windows::Forms::Label());


this->label3 = (gcnew System::Windows::Forms::Label());


this->label4 = (gcnew System::Windows::Forms::Label());


this->label5 = (gcnew System::Windows::Forms::Label()); this->label6 = (gcnew System::Windows::Forms::Label()); this->SuspendLayout();


//



  • button1







this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft

YaHei", 15.75F, System::Drawing::FontStyle::Bold,


System::Drawing::GraphicsUnit::Point,


static_cast(0)));




this->button1->Location = System::Drawing::Point(121, 231); this->button1->Name = L"button1";


this->button1->Size = System::Drawing::Size(129, 36); this->button1->TabIndex = 0; this->button1->Text = L"Hisoblash"; this->button1->UseVisualStyleBackColor = true;


this->button1->Click += gcnew System::EventHandler(this,

&Form1::button1_Click);




//



  • textBox1







this->textBox1->Location = System::Drawing::Point(49, 55); this->textBox1->Name = L"textBox1";


this->textBox1->Size = System::Drawing::Size(51, 20); this->textBox1->TabIndex = 1;







  • textBox2



//


this->textBox2->Location = System::Drawing::Point(155, 55); this->textBox2->Name = L"textBox2"; this->textBox2->Size = System::Drawing::Size(62, 20); this->textBox2->TabIndex = 2;


//



  • textBox3







this->textBox3->Location = System::Drawing::Point(256, 55); this->textBox3->Name = L"textBox3";


this->textBox3->Size = System::Drawing::Size(49, 20); this->textBox3->TabIndex = 3;







  • label1



//


this->label1->AutoSize = true;


this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans

Serif", 12, System::Drawing::FontStyle::Bold,


System::Drawing::GraphicsUnit::Point,


static_cast(0)));




this->label1->Location = System::Drawing::Point(106, 55);


this->label1->Name = L"label1";


this->label1->Size = System::Drawing::Size(45, 20);


this->label1->TabIndex = 4;


this->label1->Text = L"x^2+";


this->label1->Click += gcnew System::EventHandler(this,

&Form1::label1_Click);




//



  • label2







this->label2->AutoSize = true;


this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans

Serif", 12, System::Drawing::FontStyle::Bold,


System::Drawing::GraphicsUnit::Point,


static_cast(0))); this->label2->Location = System::Drawing::Point(223, 55); this->label2->Name = L"label2";




this->label2->Size = System::Drawing::Size(27, 20); this->label2->TabIndex = 5; this->label2->Text = L"x+";


//



  • label3







this->label3->AutoSize = true;


this->label3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans

Serif", 12, System::Drawing::FontStyle::Bold,


System::Drawing::GraphicsUnit::Point,


static_cast(0))); this->label3->Location = System::Drawing::Point(311, 55); this->label3->Name = L"label3";




this->label3->Size = System::Drawing::Size(29, 20); this->label3->TabIndex = 6; this->label3->Text = L"=0";


//



  • label4







this->label4->AutoSize = true;


this->label4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans

Serif", 12, System::Drawing::FontStyle::Bold,


System::Drawing::GraphicsUnit::Point,


static_cast(0)));




this->label4->Location = System::Drawing::Point(45, 131);


this->label4->Name = L"label4";


this->label4->Size = System::Drawing::Size(37, 20);


this->label4->TabIndex = 7;


this->label4->Text = L"x1=";


this->label4->Click += gcnew System::EventHandler(this,

&Form1::label4_Click);




//



  • label5







this->label5->AutoSize = true;



this->label5->Font = (gcnew System::Drawing::Font(L"Microsoft Sans

Serif", 12, System::Drawing::FontStyle::Bold,


System::Drawing::GraphicsUnit::Point,


static_cast(0))); this->label5->Location = System::Drawing::Point(252, 131); this->label5->Name = L"label5";




this->label5->Size = System::Drawing::Size(37, 20); this->label5->TabIndex = 8; this->label5->Text = L"x2=";


//



  • label6







this->label6->AutoSize = true;


this->label6->Font = (gcnew System::Drawing::Font(L"Microsoft Sans

Serif", 12, System::Drawing::FontStyle::Bold,


System::Drawing::GraphicsUnit::Point,


static_cast(0))); this->label6->Location = System::Drawing::Point(30, 176); this->label6->Name = L"label6";




this->label6->Size = System::Drawing::Size(0, 20); this->label6->TabIndex = 9;


//



  • Form1







this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->BackColor = System::Drawing::Color::Aquamarine; this->ClientSize = System::Drawing::Size(398, 295); this->Controls->Add(this->label3); this->Controls->Add(this->label2); this->Controls->Add(this->label1); this->Controls->Add(this->textBox3); this->Controls->Add(this->textBox2); this->Controls->Add(this->textBox1); this->Controls->Add(this->label6); this->Controls->Add(this->label5); this->Controls->Add(this->label4); this->Controls->Add(this->button1);


this->ForeColor = System::Drawing::SystemColors::ControlDarkDark; this->Name = L"Form1";


this->Text = L"Form1";


this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load); this->ResumeLayout(false);


this->PerformLayout();

}

int g,s;



#pragma endregion


private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {

}



private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {

int a,b,c,d,x1,x2;


a=Convert::ToInt32(textBox1->Text);


b=Convert::ToInt32(textBox2->Text);


c=Convert::ToInt32(textBox3->Text);


d=(pow(b,2)-4*a*c);




if (d>=0){

x1=(-b+pow(d,1/2))/2*a;


x2=(-b-pow(d,1/2))/2*a;


label4->Text="x1= "+x1.ToString();


label5->Text="x2= "+x2.ToString();


}



else

{

label6->Text="Kvadrat tenglama ildizlarga ega emas!!!";

}

}


private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) {

}



private: System::Void label4_Click(System::Object^ sender, System::EventArgs^ e) {

}

};

}



Dastur Natijasi:

Download 233,09 Kb.

Do'stlaringiz bilan baham:
1   2




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish