-qadam: 1- formaga boshqa formalarni bog‘lash uchun quyidagi kodlar kiritiladi: #include
bet 63/134 Sana 20.07.2022 Hajmi 5,98 Mb. #829272
1-qadam: 1- formaga boshqa formalarni bog‘lash uchun quyidagi kodlar kiritiladi: #include "Form2.h"; #include "Form3.h"; #include "Form31.h";
3.17-rasm. 1-formaning ko‘rinishi
1- forma 2- formaga bog‘lanishi uchun CheckBox tugmasining
Onclick hodisasiga quyidagi kodlar kiritiladi:
Form2^ open=gcnew Form2();
this->Hide(); open->Show();
1- forma 3- formaga bog‘lanishi uchun CheckListBox
tugmasining Onclick hodisasiga quyidagi kodlar kiritiladi:
Form3^ open=gcnew Form3();
this->Hide(); open->Show();
forma 3- formaga bog‘lanish uchun ComboBox tugmasining
Onclick hodisasiga quyidagi kodlar kiritiladi:
Form3^ open=gcnew Form3();
this->Hide(); open->Show();
qadam: 32 – variantdagi masalani ye chish uchun 2- formada button ning Onclick hodisasiga quyidagi kodlar kiritiladi:
1. private: System::Void button1_Click(System::Object^ sender,System::EventArgs^ e) {
2. int a[10][10]; s=0; int n,m;
if(textBox1->Text!="" && textBox2->Text!=""){
n=Convert::ToInt32(textBox1->Text);
m=Convert::ToInt32(textBox2->Text);}
if(checkBox1->Checked && checkBox2->Checked ){
if(checkBox4->Checked){Form2::BackColor=
System::Drawing::Color::Yellow; }
if(checkBox5->Checked){Form2::BackColor=
System::Drawing::Color::Red; }
if(checkBox6->Checked){Form2::BackColor=
System::Drawing::Color::Green; }
for(int i=0;i if(g==0){dataGridView1->Rows->Add();} 14. for(int j=0;j
dataGridView1->Columns[j]->HeaderText= (j+1).ToString()+" - ustun";
dataGridView1->Rows[i]->Cells[j]->Value =a[i][j].ToString(); 17. if(a[i][j]%2==0){s+=a[i][j];} }} g+=1;
MessageBox::Show("Juftlari yig'indisi= " + s.ToString()); }
if(checkBox1->Checked && checkBox3->Checked ){s=0;
for(int i=0;iRows->Add();}
for(int j=0;j
dataGridView1->Rows[i]->Cells[j]->Value ); 23. if(a[i][j]%2==0){s+=a[i][j];} } }
24. MessageBox::Show("Juftlari yig'indisi= " + s.ToString());}
3.18-rasm. 2- formaning ko‘rinishi
qadam: 32 – variantdagi masalani ye chish uchun 3- formada button1 ning Click hodisasiga quyidagi kodlar kiritiladi:
private: System::Void button1_Click(System::Object^ sender,
System::EventArgs^ e) { int g,s;
#pragma endregion
void index(int indexChecked[]){ int i=0;
IEnumerator^ myEnum1 = checkedListBox1->
CheckedIndices->GetEnumerator();
while( myEnum1->MoveNext()){
indexChecked[i] = *safe_cast(myEnum1->Current); i++; } }
private: System::Void button1_Click(System::Object^ sender,
System::EventArgs^ e) {
int a[10][10]; int indexChecked[10]; s=0; int n,m;
if(textBox1->Text!="" && textBox2->Text!=""){
n=Convert::ToInt32(textBox1->Text);
m=Convert::ToInt32(textBox2->Text);} index(indexChecked);
if (indexChecked[0]==0 && indexChecked[1]==1){
if (indexChecked[2]==3{
Form3::BackColor=System::Drawing::Color::Yellow; }
if (indexChecked[2]==4){
Form3::BackColor=System::Drawing::Color::Red; }
if (indexChecked[2]==5){
Form3::BackColor=System::Drawing::Color::Green; }
for(int i=0;iRows->Add();} 23. for(int j=0;j
dataGridView1->Columns[j]->HeaderText= (j+1).ToString()+" - ustun";
dataGridView1->Rows[i]->Cells[j]->Value =a[i][j].ToString(); 26. if(a[i][j]%2==0){s+=a[i][j];} }} g+=1;
MessageBox::Show("Juftlari yig'indisi= " + s.ToString()); }
if ( indexChecked[0]==0 && indexChecked[1]==2){
if ( indexChecked[2]==3){
Form3::BackColor=System::Drawing::Color::Yellow; }
if ( indexChecked[2]==4){
Form3::BackColor=System::Drawing::Color::Red; }
if ( indexChecked[2]==5){
Form3::BackColor=System::Drawing::Color::Green; } 35. s=0;
for(int i=0;iRows->Add();}
for(int j=0;j
dataGridView1->Rows[i]->Cells[j]->Value ); 39. if(a[i][j]%2==0){s+=a[i][j];} }}
40. MessageBox::Show("Juftlari yig'indisi= " + s.ToString());}}
3.19-rasm. 3- formaning ko‘rinishi
qadam: 32 – variantdagi masalani ye chish uchun 4- formada quyidagi kodlar kiritiladi:
int g,s;
#pragma endregion
private: System::Void Form31_FormClosed(System::Object^ sender,
System::Windows::Forms::FormClosedEventArgs^ e) {
Application::Restart(); }
button1 ning Click hodisasiga quyidagi kodlar tеriladi:
private: System::Void button1_Click(System::Object^ sender,
System::EventArgs^ e) {
int a[10][10]; int indexChecked[10]; s=0; int n,m;
if(textBox1->Text!="" && textBox2->Text!=""){
n=Convert::ToInt32(textBox1->Text);
m=Convert::ToInt32(textBox2->Text);}
if(comboBox1->Text=="Tasodifiy sonlar bilan to'ldirish"){
if(checkBox1->Checked){ if(checkBox4->Checked){
Form31::BackColor=System::Drawing::Color::Yellow; }
if(checkBox5->Checked){
Form31::BackColor=System::Drawing::Color::Red; }
if(checkBox6->Checked){
Form31::BackColor=System::Drawing::Color::Green; }
for(int i=0;i
if(g==0){ dataGridView1->Rows->Add();}
16. for(int j=0;j
dataGridView1->Columns[j]->HeaderText=
(j+1).ToString()+" - ustun";
dataGridView1->Rows[i]->Cells[j]->Value =a[i][j].ToString(); 20. if(a[i][j]%2==0){ s+=a[i][j];}}} g+=1;
MessageBox::Show("Juftlari yig'indisi= " + s.ToString());} }
if(comboBox1->Text=="DataGridWiew dan kiritish"){
if(checkBox1->Checked){ if(checkBox4->Checked){
Form31::BackColor=System::Drawing::Color::Yellow; }
if(checkBox5->Checked){
Form31::BackColor=System::Drawing::Color::Red; }
if(checkBox6->Checked){
Form31::BackColor=System::Drawing::Color::Green;} s=0;
for(int i=0;i
if(g==0){dataGridView1->Rows->Add();}
for(int j=0;j
a[i][j]=Convert::ToInt32( dataGridView1->Rows[i]->Cells[j]-
>Value );
33. if(a[i][j]%2==0){s+=a[i][j];} }}
34. MessageBox::Show("Juftlari yig'indisi= " + s.ToString());} }
35. }
3.20-rasm. 4- formaning ko‘rinishi
TabControl va RadioButton komponеntalari
Ushbu komponеntalar boshqarishni osonlashtirish va ekranning ichki sohasidan optimal foydalanish uchun ishlatiladi. Ko‘p miqdordagi boshqariluvchi ma`lumotlarni ko‘rsatish kеrak bo‘lganda TabControl komponеntasidan foydalangan ma`qul.
Uchta TabControl komponеntalarida RadioButton tanlash komponеntalaridan foydalangan holda matn uchun bеrilgan ikki variantdan birini tanlaydigan, matn uchun rang va o‘lcham bеradigan dastur tuzish masalasi qo‘yilsin. Masalaning dastur ko‘rinishi 3.21- rasmda kеltirilgan.
Qo‘yilgan masalani yechish uchun Visual Studio 2012 dasturi ishga tushiriladi, asosiy oyna mеnyu bo‘limlaridan File->New-
Do'stlaringiz bilan baham: