GURUH
F.I
HEMISDAGI
RAQAMI
BALL(5)
640-23
Abdullayev
Abdurahmon
1
2-dedline.Blaknot dasturini tayyorlash.
Men Blaknot dasturini tayyorlash uchun C++ Builder dasturlash muhitining
Rad Studio XE3 versiyasidan foydalandim. C++ Builderda yangi loyiha yaratamiz:
Birinchi navbatda
Form
oynasini hosil qilib olamiz. Menyulardan foydalanish uchun
MainMenu
komponentasida foydalanamiz.
Va unga kerakli menyularni yozib olamiz.
Songra ularga
ShotCut (tezkor tugmalarni)
boglab chiqamiz.Bu ishni
Properities-
>ShotCut
bolimida bajaramiz.
Dizayinimiz chiroyli bo’lishi uchun ikonkalardan foydalanamiz bu ish uchun bizga
ImageList
komponentasi kerak boladi.
Unga kerakli ikonkalarni yuklab olamiz va
Main Menuga
bog’lab olamiz.
Shrift dan foydalanishimiz uchun
FontDialog
komponentasidan foydalanamiz va
uni ham
MainMenuga
bog’lab olamiz.
Bloknotdan foydalanish uchun unga
Memo
komponentasini olamiz va uning
hususiyatini
alClient
Qilib qoyamiz.
Memo
ham
Edit
ga oxshagan kompnenta lekin
farqi u 65536 ta qiymat qabul qiladi va enterlarni ham oz ichiga oladi.
Dasturimizga kerakli kodlarni yozamiz:
//---------------------------------------------------------------------------
#include
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
String fn;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Open1Click(TObject *Sender)
{
if (OpenDialog1->Execute()) {
Memo1->Lines->LoadFromFile(OpenDialog1->FileName) ;
fn=OpenDialog1->FileName ;
Form1->Caption=fn;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SaveAs1Click(TObject *Sender)
{
if (SaveDialog1->Execute()) {
Memo1->Lines->SaveToFile(SaveDialog1->FileName) ;
fn=SaveDialog1->FileName ;
Form1->Caption=fn;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Save1Click(TObject *Sender)
{ if (Form1->Caption=="Dokument 1") {
SaveAs1->Click();
}
if (Memo1->Modified) {
Memo1->Lines->SaveToFile(fn);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::New1Click(TObject *Sender)
{
if (Memo1->Modified) {
switch (MessageDlg("O'zgarishlarni saqlaysizmi",
mtConfirmation,mbYesNoCancel,0)) {
case mrYes: SaveAs1->Click();break;
case mrNo: Memo1->Clear();break;
case mrCancel: break;
default:
;
}
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::exit1Click(TObject *Sender)
{
if (Memo1->Modified) {
switch (MessageDlg("O'zgarishlarni saqlaysizmi",
mtConfirmation,mbYesNoCancel,0)) {
case mrYes: SaveAs1->Click();break;
case mrNo: Form1->Close();break;
case mrCancel: break;
default:
;
}
}
else {
Form1->Close();
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
if (Memo1->Modified) {
switch (MessageDlg("O'zgarishlarni saqlaysizmi",
mtConfirmation,mbYesNoCancel,0)) {
case mrYes: SaveAs1->Click();break;
case mrNo: Form1->Close();break;
case mrCancel: break;
default:
;
}
}
else {
Form1->Close();
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Print1Click(TObject *Sender)
{
if (PrintDialog1->Execute()) {
AnsiString tempFileName = "c:/toprint.txt";
Memo1->Lines->SaveToFile(tempFileName);
ShellExecuteA(Handle, "print", tempFileName.c_str(), NULL, NULL, NULL);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Cut1Click(TObject *Sender)
{
Memo1->CutToClipboard();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Paste1Click(TObject *Sender)
{
Memo1->PasteFromClipboard();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Copy1Click(TObject *Sender)
{
Memo1->CopyToClipboard();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SelectAll1Click(TObject *Sender)
{
Memo1->SelectAll();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Delete1Click(TObject *Sender)
{
Memo1->Lines->Clear();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Font1Click(TObject *Sender)
{ if (FontDialog1->Execute()) {
Memo1->Font=FontDialog1->Font;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::AboutUs1Click(TObject *Sender)
{
ShowMessage(" Men Abdullayev Abdurahmon Abduraximjon o'g'li 2005 - yil
22- aprelda tavallud topganman.2023-yil TATU Farg'ona filiali talabasi bo'ldim.
Hozirda KIF fakulteti Kompyuter injinering yo'nalishi 640-23 guruhda tahsil
olmoqdaman. ");}
//---------------------------------------------------------------------------
void __fastcall TForm1::Uzb1Click(TObject *Sender)
{
File1->Caption="Fayl";
New1->Caption="Yangi";
Open1->Caption="Ochish";
Save1->Caption="Saqlash";
SaveAs1->Caption="Yangi Saqlash";
exit1->Caption="Chiqish";
Edite1->Caption="Tahrirlash";
Cut1->Caption="Qirqish";
Copy1->Caption="Nusxalash";
Paste1->Caption="Qo`yish";
SelectAll1->Caption="Barchasini belgilash";
Delete1->Caption="O`chirish";
Shirift1->Caption="Shrift";
Font1->Caption="Font";
Lang1->Caption="Til";
AboutUs1->Caption="Biz haqimizda";
Help1->Caption="Yordam" ;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Rus1Click(TObject *Sender)
{
File1->Caption="Файл";
New1->Caption="Новый";
Open1->Caption="Открыть";
Save1->Caption="Сахранять";
SaveAs1->Caption="Сахранять все";
exit1->Caption="Выход";
Edite1->Caption="Редактировать";
Cut1->Caption="Резать";
Copy1->Caption="Копировать";
Paste1->Caption="Вставить";
SelectAll1->Caption="Выбрать все";
Delete1->Caption="Удалить";
Shirift1->Caption="Шрифт";
Font1->Caption="Шрифт";
Lang1->Caption="Язык";
AboutUs1->Caption="О нас";
Help1->Caption="Помощь" ;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Eng1Click(TObject *Sender)
{
File1->Caption="File";
New1->Caption="New";
Open1->Caption="Open";
Save1->Caption="Save";
SaveAs1->Caption="Save As";
exit1->Caption="Exit";
Edite1->Caption="Edit";
Cut1->Caption="Cut";
Copy1->Caption="Copy";
Paste1->Caption="Paste";
SelectAll1->Caption="Select All";
Delete1->Caption="Delete";
Shirift1->Caption="Shrift";
Font1->Caption="Font";
Lang1->Caption="Lang";
AboutUs1->Caption="About Us";
Help1->Caption="Help" ;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Help1Click(TObject *Sender)
{
ShowMessage(" +998 90 344 04 22 murojaat qilin");
}
//---------------------------------------------------------------------------
Blaknotimiz tayyor!
|