2-Dedline: Shaxsiy bloknot dasturini tuzish


Download 27.96 Kb.
Sana01.05.2020
Hajmi27.96 Kb.
#102620
Bog'liq
640-19Umarov Husanboy


2-Dedline:Shaxsiy bloknot dasturini tuzish

Forma komponentalari bu dasturni boshqarish uchun maxsus tugmachalar
bo‘lib uni formaga joylashtirishdan oldin bosh oynadan kerakli komponentalar
palitrasi tanlanadi. Masalan, Standart (Standart) komponentalar palitrasida
quyidagi piktogrammalar (tugmachalar) majmuasi mavjud:

Birinchi novbatda Form1 oynasiga Panel yaratib olamiz.

PopupMenu - yordamchi yoki lokal menyusi. Bu menyu oynada sichqoncha
o‘ng tugmasini bosish bilan chiqadi

MainMenu - dastur bosh menyusi. Komponenta murakkab ierarxik
strukturali menyu yaratish uchun xizmat qiladi.

//---------------------------------------------------------------------------

#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::Chiqish1Click(TObject *Sender)

{

if(RichEdit1->Modified)



{ switch(MessageDlg("O'zgargan malumot saqlansinmi?",mtConfirmation,mbYesNoCancel,0))

{case mrYes:Saqlash1->Click();Close();break;

case mrNo:RichEdit1->Clear();break;

case mrCancel:Abort();break;

}

}

}



//---------------------------------------------------------------------------

void __fastcall TForm1::Yanginombilansaqlash1Click(TObject *Sender)

{

if(SaveDialog1->Execute())



{ RichEdit1->Lines->SaveToFile(SaveDialog1->FileName) ;

fn=SaveDialog1->FileName;

Form1->Caption=fn;

RichEdit1->Modified=False;

}

}

//---------------------------------------------------------------------------



void __fastcall TForm1::Ochish1Click(TObject *Sender)

{

OpenDialog1->Execute();



RichEdit1->Lines->LoadFromFile(OpenDialog1->FileName);

fn=OpenDialog1->FileName;

Form1->Caption=fn;

}

//---------------------------------------------------------------------------



void __fastcall TForm1::Saqlash1Click(TObject *Sender)

{

if(fn.IsEmpty())



{Yanginombilansaqlash1->Click();

}

else



{RichEdit1->Lines->SaveToFile(fn);RichEdit1->Modified=False;

}

}



//---------------------------------------------------------------------------

void __fastcall TForm1::Yangifaylochish1Click(TObject *Sender)

{

if(RichEdit1->Modified)



{ switch(MessageDlg("O'zgargan malumot saqlansinmi?",mtConfirmation,mbYesNoCancel,0))

{case mrYes:Saqlash1->Click();break;

case mrNo:RichEdit1->Clear();break;

case mrCancel:;break;

}

}

}



//---------------------------------------------------------------------------

void __fastcall TForm1::chopetish1Click(TObject *Sender)

{

PrintDialog1->Execute();



RichEdit1->Print(RichEdit1->Text);

}

//---------------------------------------------------------------------------



void __fastcall TForm1::Qirqish1Click(TObject *Sender)

{

RichEdit1->CutToClipboard();



}

//---------------------------------------------------------------------------

void __fastcall TForm1::Nushalash1Click(TObject *Sender)

{

RichEdit1->CopyToClipboard();



}

//---------------------------------------------------------------------------

void __fastcall TForm1::joylash1Click(TObject *Sender)

{

RichEdit1->PasteFromClipboard();



}

//---------------------------------------------------------------------------

void __fastcall TForm1::Barchasinibelgilash1Click(TObject *Sender)

{

RichEdit1->SelectAll();



}

//---------------------------------------------------------------------------

void __fastcall TForm1::Shrift1Click(TObject *Sender)

{

FontDialog1->Execute();



RichEdit1->Font=FontDialog1->Font;

}

//---------------------------------------------------------------------------



void __fastcall TForm1::Qirqish2Click(TObject *Sender)

{

Qirqish1->Click() ;



}

//---------------------------------------------------------------------------

void __fastcall TForm1::Barchasinibelgilash2Click(TObject *Sender)

{

Barchasinibelgilash1-> Click();



}

//---------------------------------------------------------------------------

void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)

{

if(RichEdit1->Modified)



{ switch(MessageDlg("O'zgargan malumot saqlansinmi?",mtConfirmation,mbYesNoCancel,0))

{case mrYes:Saqlash1->Click();break;

case mrNo:RichEdit1->Clear();break;

case mrCancel:;break;

}

}

}



//---------------------------------------------------------------------------

void __fastcall TForm1::Nusxalash2Click(TObject *Sender)

{

Nushalash1->Click();



}

//---------------------------------------------------------------------------

void __fastcall TForm1::joylash2Click(TObject *Sender)

{

joylash1->Click();



}

//---------------------------------------------------------------------------

void __fastcall TForm1::Barchasini1Click(TObject *Sender)

{

Barchasinibelgilash1->Click();



}

//---------------------------------------------------------------------------

void __fastcall TForm1::FormCreate(TObject *Sender)

{

}



//---------------------------------------------------------------------------




Download 27.96 Kb.

Do'stlaringiz bilan baham:




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