Zbekiston respublikasi axborot texnologiyalari va kommunikatsiyalarini rivojlantirish vazirligi



Download 0.62 Mb.
bet3/3
Sana22.05.2021
Hajmi0.62 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.62 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
O’zbekiston respublikasi
maxsus ta’lim
zbekiston respublikasi
axborot texnologiyalari
o’rta maxsus
davlat pedagogika
nomidagi toshkent
guruh talabasi
pedagogika instituti
texnologiyalari universiteti
toshkent axborot
xorazmiy nomidagi
rivojlantirish vazirligi
samarqand davlat
haqida tushuncha
navoiy nomidagi
toshkent davlat
nomidagi samarqand
ta’limi vazirligi
Darsning maqsadi
vazirligi toshkent
Toshkent davlat
tashkil etish
kommunikatsiyalarini rivojlantirish
Ўзбекистон республикаси
Alisher navoiy
matematika fakulteti
bilan ishlash
Nizomiy nomidagi
vazirligi muhammad
pedagogika universiteti
fanining predmeti
таълим вазирлиги
sinflar uchun
o’rta ta’lim
maxsus ta'lim
fanlar fakulteti
ta'lim vazirligi
Toshkent axborot
махсус таълим
tibbiyot akademiyasi
umumiy o’rta
pedagogika fakulteti
haqida umumiy
Referat mavzu
fizika matematika
universiteti fizika
ishlab chiqarish
Navoiy davlat