O‘zbekiston Respublikasi Raqamli texnologiyalar vazirligi Muhammad Al-Xorazmiy
Download 0.55 Mb.
|
2 dedline Xalimjonov Abdulahad 615 22 dasturlash2 kontaktlar
- Bu sahifa navigatsiya:
- 615-22 guruh talabasi Xalimjonov Abdulahadning Dasturlash II fanidan 2 – Dedline topshirig’i
- 1 – rasm.
O‘zbekiston Respublikasi Raqamli texnologiyalar vazirligi Muhammad Al-Xorazmiy nomidagi Toshkent axborot texnologiyalari universiteti farg‘ona filiali Kompyuter injinering fakulteti Kompyuter injinering yo’nalishi 615-22 guruh talabasi Xalimjonov Abdulahadning Dasturlash II fanidan 2 – Dedline topshirig’i Bajardi : Xalimjonov Abdulahad Qabul qildi: Xolmatov Abrorjon 2 - Dedline Mavzu: C++ Builder dasturida kontaklar dasturini yaratish Avval yangi proyetk yaratib, save all orqali saqlab olamiz. Keyin taxminiy o’lchamlarni olib, bloknotga o’xshatib olamiz. Form1 oynasini captioniga o’zimiz hohlagan nomni yozamiz, Bloknot. BorderIcons funksiyasidan biMaximizeni false qilib qo’yamiz. Position funksiyasini esa poScreenCenter qilib qo’yamiz. Formani rangini Color xususiyatidan clWhite qilamiz. Undan keyin esa Tool Palette dan 2ta panel, statictext, speedbuttonlarni tartib bilan Formaga tashlab olamiz. Panelni Captionini o’chirib yuboramiz. 1 – rasm. Forma yaratilgandagi ko’rinishi 2 – rasm. Formaga panellar va speedbuttonlar tashlangandagi ko’rinishi 3 – rasm. Form2 ko’rinishi 4 – rasm. Kod qismlari va dasturni ishlagandagi ko’rinishi Ilova Dasturning kod qismi: TForm1 *Form1; bool yuklandi = false; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::FormActivate(TObject *Sender) { if (FileExists("kontaktlar.dat") && !yuklandi) { ListBox1->Items->LoadFromFile("kontaktlar.dat"); } yuklandi = true; ListBox1->SetFocus(); }
void __fastcall TForm1::SpeedButton2Click(TObject *Sender) { Form3->eFam->Text = ""; Form3->eIsm->Text = ""; Form3->eTel->Text = ""; Form3->Caption = ".:: Yangi kontakt qo'shish ::."; Form3->ShowModal(); }
void __fastcall TForm1::SpeedButton3Click(TObject *Sender)
void __fastcall TForm1::SpeedButton5Click(TObject *Sender) { if (ListBox1->Items->Count < 2) { ShowMessage("Ko'rish uchun ma'lumot yo'q"); } else if (ListBox1->ItemIndex == -1) { ShowMessage("Tahrirlash uchun tanlang"); } else { index = (ListBox1->ItemIndex % 2 == 0) ? ListBox1->ItemIndex : ListBox1->ItemIndex - 1; String fi = ListBox1->Items->Strings[index]; String tel = ListBox1->Items->Strings[index + 1]; String fam, ism; int probelPosition = fi.Pos(" "); fam = fi.SubString(1, probelPosition - 1); ism = fi.SubString(probelPosition + 1, fi.Length() - probelPosition); Form3->eFam->Text = fam; Form3->eIsm->Text = ism; Form3->eTel->Text = tel; Form3->Caption = ".:: Kontaktni ko'rish ::."; Form3->eFam->ReadOnly = true; Form3->eIsm->ReadOnly = true; Form3->eTel->ReadOnly = true; Form3->ShowModal(); } } //--------------------------------------------------------------------------- void __fastcall TForm1::SpeedButton4Click(TObject *Sender) { if (ListBox1->Items->Count < 2) { ShowMessage("O'chirish uchun ma'lumot yo'q"); } else if (ListBox1->ItemIndex == -1) { ShowMessage("O'chirish uchun tanlang"); } else { index = (ListBox1->ItemIndex % 2 == 0) ? ListBox1->ItemIndex : ListBox1->ItemIndex - 1; int res = MessageDlg("Chindan ham o'chirmoqchimisiz?", mtWarning, TMsgDlgButtons()< ListBox1->Items->Delete(index + 1); ListBox1->Items->Delete(index); Form1->ListBox1->Items->SaveToFile("kontaktlar.dat"); ShowMessage("O'chirildi"); } } } //--------------------------------------------------------------------------- void __fastcall TForm1::SpeedButton1Click(TObject *Sender) { if (Edit1->Text.Trim() != "") { bool topildi = false; for (int i = ListBox1->ItemIndex + 1; i < ListBox1->Items->Count; i++) { if (ListBox1->Items->Strings[i].Pos(Edit1->Text.Trim()) > 0) { ListBox1->ItemIndex = i; topildi = true; return; } } if (!topildi && ListBox1->ItemIndex != 0) { for (int i = 0; i < ListBox1->Items->Count; i++) { if (ListBox1->Items->Strings[i].Pos(Edit1->Text.Trim()) > 0) { ListBox1->ItemIndex = i; topildi = true; return; } }
} //--------------------------------------------------------------------------- void __fastcall TForm1::ListBox1DblClick(TObject *Sender) { SpeedButton3->Click(); } //--------------------------------------------------------------------------- Download 0.55 Mb. Do'stlaringiz bilan baham: |
ma'muriyatiga murojaat qiling