Visual c++ muhitida bloknot dasturini tuzish


Download 346.89 Kb.
Sana19.06.2023
Hajmi346.89 Kb.
#1609763
Bog'liq
Aminjonov Diyorbek



Visual c++ muhitida bloknot dasturini tuzish
//---------------------------------------------------------------------------

#include


#pragma hdrstop

#include "Unit1.h"


//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
bool saved;
AnsiString fileName;

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


__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Save1Click(TObject *Sender)


{

SaveDialog1->Execute();


Memo1->Lines->SaveToFile(SaveDialog1->FileName);

}
//---------------------------------------------------------------------------


void __fastcall TForm1::Open1Click(TObject *Sender)
{
OpenDialog1->Execute();
Memo1->Lines->LoadFromFile(OpenDialog1->FileName) ;

}
//---------------------------------------------------------------------------


void __fastcall TForm1::Cut1Click(TObject *Sender)


{
Memo1->CutToClipboard();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Copy1Click(TObject *Sender)


{
Memo1->CopyToClipboard();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Paste1Click(TObject *Sender)


{
Memo1->PasteFromClipboard();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Delate1Click(TObject *Sender)


{
Memo1->Clear();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N4Click(TObject *Sender)
{
FontDialog1->Execute();
Memo1->Font=FontDialog1->Font;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::N1Click(TObject *Sender)


{
Memo1->SelectAll();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Datatime1Click(TObject *Sender)


{
Memo1->Lines->Add(DateTimeToStr(Now()));
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Exit1Click(TObject *Sender)


{
Close();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Dasturdanchiqish1Click(TObject *Sender)


{
if (Memo1->Modified) {
int res = MessageDlg("Saqlaysizmiq",mtWarning,TMsgDlgButtons()< if(res == mrYes)
{
if (!saved) {
if (SaveDialog1->Execute()) {
fileName = SaveDialog1->FileName;
saved = true;
Memo1->Lines->SaveToFile(fileName);
}
}
else
{
Memo1->Lines->SaveToFile(fileName);
}
Memo1->Modified = false;
Close();
}
else
if (res == mrNo)
{
Close();
}
}
else
{
Close();
}
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Fined1Click(TObject *Sender)


{

if (ColorDialog1->Execute())


Memo1->Color=ColorDialog1->Color;

}
//---------------------------------------------------------------------------
Download 346.89 Kb.

Do'stlaringiz bilan baham:




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