Zbekiston respublikasi axborot texnologiyalari va kommunikatsiyalarini rivojlantirish vazirligi



Download 0.54 Mb.
bet3/3
Sana22.05.2021
Hajmi0.54 Mb.
1   2   3
Kod qismi :

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

#include

#pragma hdrstop

#include "Unit1.h"

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

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm1 *Form1;

String filename ;

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

__fastcall TForm1::TForm1(TComponent* Owner)

: TForm(Owner)

{

}



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

void __fastcall TForm1::SaveAs1Click(TObject *Sender)

{if(SaveTextFileDialog1->Execute())

{

filename = SaveTextFileDialog1->FileName ;



RichEdit1->Lines->SaveToFile(filename);

}

}



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

void __fastcall TForm1::Open1Click(TObject *Sender)

{

if(OpenTextFileDialog1->Execute())



{

filename = OpenTextFileDialog1->FileName ;

RichEdit1->Lines->LoadFromFile(filename);

RichEdit1->Modified = False ;

}

}

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



void __fastcall TForm1::FormCreate(TObject *Sender)

{

filename = "" ;



}

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

void __fastcall TForm1::Save1Click(TObject *Sender)

{

if(filename == ""){



SaveAs1->Click();

} else{


RichEdit1->Lines->SaveToFile(filename);

} }


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

void __fastcall TForm1::New1Click(TObject *Sender)

{

if(RichEdit1->Modified == True){



int r = MessageDlg("Ma`lumotni saqlaysizmi?",mtInformation,TMsgDlgButtons()<

if(r == mrYes){

Save1->Click();

}else if(r == mrCancel){

return ;

}

}



RichEdit1->Text = "";

RichEdit1->Modified = False;

filename = "" ;

}

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



void __fastcall TForm1::FormCloseQuery(TObject *Sender, bool &CanClose)

{

if(RichEdit1->Modified == True){



int r = MessageDlg("Ma`lumotni saqlaysizmi ?",mtInformation,TMsgDlgButtons()<

if(r == mrYes){

Save1->Click();

}else if(r == mrCancel){

CanClose = false ;

}

}



RichEdit1->Text = "";

RichEdit1->Modified = False;

filename = "" ;

}

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



void __fastcall TForm1::Exit1Click(TObject *Sender)

{

Close();



}

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

void __fastcall TForm1::WordWrap1Click(TObject *Sender)

{

WordWrap1->Checked = !WordWrap1->Checked ;



RichEdit1->WordWrap = WordWrap1->Checked ;

}

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



void __fastcall TForm1::RichEdit1Change(TObject *Sender)

{

StatusBar1->Panels->Items[1]->Text = RichEdit1->Text.Length();



}

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

void __fastcall TForm1::Cut1Click(TObject *Sender)

{

RichEdit1->CutToClipboard();



}

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

void __fastcall TForm1::Copy1Click(TObject *Sender)

{

RichEdit1->CopyToClipboard();



}

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

void __fastcall TForm1::Paste1Click(TObject *Sender)

{

RichEdit1->PasteFromClipboard();



}

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

void __fastcall TForm1::SelectAll1Click(TObject *Sender)

{

RichEdit1->SelectAll();



}

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

void __fastcall TForm1::Font1Click(TObject *Sender)

{

FontDialog1->Execute();



RichEdit1->Font = FontDialog1->Font ;

}

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



void __fastcall TForm1::Delete1Click(TObject *Sender)

{

RichEdit1->Lines->Clear();



}

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

void __fastcall TForm1::imeDate1Click(TObject *Sender)

{

StatusBar1->Panels->Items[2]->Text = Now();



}

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

void __fastcall TForm1::Find1Click(TObject *Sender)

{

FindDialog1->FindText = RichEdit1->SelText;



FindDialog1->Execute();

}

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



void __fastcall TForm1::ReplaceDialog1Replace(TObject *Sender)

{

RichEdit1->SetFocus();



if (RichEdit1->SelText != "")

{

RichEdit1->SelText = ReplaceDialog1->ReplaceText;



if (ReplaceDialog1->Options.Contains(frReplaceAll))

RichEdit1->SelStart += ReplaceDialog1->ReplaceText.Length();

}

else if (ReplaceDialog1->Options.Contains(frReplace))



{

ShowMessage("Текст '" + ReplaceDialog1->FindText + "' не найден");

return;

}

if (ReplaceDialog1->Options.Contains(frReplaceAll))



FindDialog1Find(Sender);

}

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



void __fastcall TForm1::FindDialog1Find(TObject *Sender)

{

int FoundAt, StartPos, ToEnd;



TSearchTypes Option;

TReplaceDialog *dlg = (TReplaceDialog *)Sender;

StartPos = RichEdit1->SelStart;

if (RichEdit1->SelLength) StartPos += RichEdit1->SelLength;

ToEnd = RichEdit1->Text.Length() - StartPos;

if (dlg->Options.Contains(frWholeWord))

Option << stWholeWord;

else Option >> stWholeWord;

if (dlg->Options.Contains(frMatchCase))

Option << stMatchCase;

else Option >> stMatchCase;

FoundAt = RichEdit1->FindText(dlg->FindText, StartPos, ToEnd, Option);

if (FoundAt != -1) // если найдено

{

RichEdit1->SelStart = FoundAt;



RichEdit1->SelLength = dlg->FindText.Length();

if ((dlg->Name == "ReplaceDialog1")&&(dlg->Options.Contains(frReplaceAll)))

ReplaceDialog1Replace(Sender);

}

else ShowMessage("Текст '" + dlg->FindText +



"' не найден");

RichEdit1->SetFocus();

}

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



void __fastcall TForm1::Left1Click(TObject *Sender)

{

RichEdit1->Paragraph->Alignment = taLeftJustify ;



}

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

void __fastcall TForm1::Right1Click(TObject *Sender)

{

RichEdit1->Paragraph->Alignment = taRightJustify ;



}

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

void __fastcall TForm1::Centr1Click(TObject *Sender)

{

RichEdit1->Paragraph->Alignment = taCenter ;



}

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

void __fastcall TForm1::Information1Click(TObject *Sender)

{

ShowMessage("Ushbu dastur 612-19 guruh talabasi Umidjon Mirzarahimov tomonidan yasalgan !!! Tushunmovchiliklar bo`lsa Telegram orqali @Umidjon_Mirzarahimov ga murojat qilishingiz mumkin .") ;



}

//---------------------------------------------------------------------------
Download 0.54 Mb.

Do'stlaringiz bilan baham:
1   2   3




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2020
ma'muriyatiga murojaat qiling

    Bosh sahifa
davlat universiteti
ta’lim vazirligi
maxsus ta’lim
O’zbekiston respublikasi
zbekiston respublikasi
axborot texnologiyalari
o’rta maxsus
nomidagi toshkent
guruh talabasi
davlat pedagogika
texnologiyalari universiteti
xorazmiy nomidagi
toshkent axborot
pedagogika instituti
rivojlantirish vazirligi
haqida tushuncha
toshkent davlat
Toshkent davlat
vazirligi toshkent
tashkil etish
matematika fakulteti
ta’limi vazirligi
kommunikatsiyalarini rivojlantirish
samarqand davlat
vazirligi muhammad
pedagogika universiteti
bilan ishlash
fanining predmeti
Darsning maqsadi
navoiy nomidagi
o’rta ta’lim
Ishdan maqsad
haqida umumiy
nomidagi samarqand
fizika matematika
sinflar uchun
fanlar fakulteti
maxsus ta'lim
Nizomiy nomidagi
ta'lim vazirligi
moliya instituti
universiteti fizika
Ўзбекистон республикаси
umumiy o’rta
Referat mavzu
respublikasi axborot
Toshkent axborot
таълим вазирлиги
Alisher navoiy
махсус таълим
Buxoro davlat