631-21 guruh talabasi Solijonov Axliddin
Mavzu:Bloknot yaratish.
Kod qismi:
//---------------------------------------------------------------------------
#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::Yangi1Click(TObject *Sender)
{
if(RichEdit1->Modified)
{
switch (MessageDlg("Ma'lumotlar o'zgargan.Saqlaysizmi?",
mtConfirmation,mbYesNoCancel,0
)) {
case mrYes: Saqlash1->Click(); break;
case mrNo:RichEdit1->Clear(); break;
case mrCancel: break;
default:
;
}
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Yangisaqlash1Click(TObject *Sender)
{
if(SaveTextFileDialog1->Execute())
{
RichEdit1->Lines->SaveToFile(SaveTextFileDialog1->FileName);
fn=SaveTextFileDialog1->FileName;
Form1->Caption=fn;
RichEdit1->Modified=false;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Ochish1Click(TObject *Sender)
{
OpenTextFileDialog1->Execute();
RichEdit1->Lines->LoadFromFile(OpenTextFileDialog1->FileName) ;
fn=OpenTextFileDialog1->FileName;
Form1->Caption=fn;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Saqlash1Click(TObject *Sender)
{
if(fn.IsEmpty())
{
Yangisaqlash1->Click();
}
else
{
RichEdit1->Lines->SaveToFile(fn);
RichEdit1->Modified=false;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Chiqish1Click(TObject *Sender)
{
if(RichEdit1->Modified)
{
switch (MessageDlg("Ma'lumotlar o'zgargan.Saqlaysizmi?",
mtConfirmation,mbYesNoCancel,0
)) {
case mrYes: Saqlash1->Click(); break;
case mrNo:RichEdit1->Modified=false; break;
case mrCancel:
Abort();
break;
default:
;
}
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Chopetish1Click(TObject *Sender)
{
PrintDialog1->Execute();
RichEdit1->Print(RichEdit1->Text) ;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Qirqis1Click(TObject *Sender)
{
RichEdit1->CutToClipboard() ;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Nusxalash1Click(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::Qirqish1Click(TObject *Sender)
{
Qirqish1->Click();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Nusxalash2Click(TObject *Sender)
{
Nusxalash1->Click();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::joylash2Click(TObject *Sender)
{
Joylash1->Click();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Barchasinibelgilash2Click(TObject *Sender)
{
Barchasinibelgilash1->Click();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ranglar1Click(TObject *Sender)
{
ColorDialog1->Execute();
RichEdit1->Color=ColorDialog1->Color;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
if(RichEdit1->Modified)
{
switch (MessageDlg("Ma'lumotlar o'zgargan.Saqlaysizmi?",
mtConfirmation,mbYesNoCancel,0
)) {
case mrYes: Saqlash1->Click();Close(); break;
case mrNo:RichEdit1->Modified=false;Close(); break;
case mrCancel:
Abort();
break;
default:
;
}
}
}
//---------------------------------------------------------------------------
Natija
Do'stlaringiz bilan baham: |