• Form
  • ImageList
  • Dasturning kod qismi
  • Gurux talabasi adhamjonova dilafruz. 2-dedline. Blaknot dasturini tayyorlash




    Download 400,54 Kb.
    Sana18.05.2024
    Hajmi400,54 Kb.
    #243022
    Bog'liq
    DILAFRUZ


    670-23 gurux talabasi ADHAMJONOVA DILAFRUZ.

    2-dedline.Blaknot dasturini tayyorlash.
    Men Blaknot dasturini tayyorlash uchun C++ Builder dasturlash muhitining Rad Studio 11 versiyasidan foydalandim. C++ Builderda yangi loyiha yaratamiz:
    Birinchi navbatda Form oynasini hosil qilib olamiz.Menyulardan foydalanish uchun MainMenu komponentasida foydalanamiz.

    Va unga kerakli menyularni yozib olamiz;

    Songra ularga ShotCut (tezkor tugmalarni) boglab chiqamiz.Bu ishni Properities->ShotCut bolimida bajaramiz.
    Dizayinimiz chiroyli bo’lishi uchun ikonkalardan foydalanamiz bu ish uchun bizga ImageList komponentasi kerak boladi.

    Unga kerakli ikonkalarni yuklab olamiz va Main Menuga boglab olamiz.

    Shrift dan foydalanishimiz uchun FontDialog komponentasidan foydalanamiz va uni ham MainMenuga bog’lab olamiz.
    Bloknotdan foydalanish uchun unga Memo komponentasini olamiz va uning hususiyatini alClient Qilib qoyamiz.Memo ham Edit ga oxshagan kompnenta lekin farqi u 65536 ta qiymat qabul qiladi va enterlarni ham oz ichiga oladi.
    Dasturimizga kerakli kodlarni yozamiz.
    Dasturning kod qismi:
    #include
    #pragma hdrstop
    #include "Unit3.h"
    #include "Unit1.h"
    //---------------------------------------------------------------------------
    #pragma package(smart_init)
    #pragma resource "*.dfm"
    TForm3 *Form3;
    AnsiString fileName= "Yangi hujjat";
    //---------------------------------------------------------------------------
    __fastcall TForm3::TForm3(TComponent* Owner)
    : TForm(Owner)
    {
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm3::Shrift2Click(TObject *Sender)
    {
    FontDialog1->Font=Memo1->Font;
    if( FontDialog1->Execute()){
    Memo1->Font = FontDialog1->Font;
    }
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm3::Nusxalash1Click(TObject *Sender)
    {
    Memo1->CopyToClipboard();
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm3::Qirqibolish1Click(TObject *Sender)
    {
    Memo1->CutToClipboard();
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm3::Joylash1Click(TObject *Sender)
    {
    Memo1->PasteFromClipboard();
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm3::Barchasinibelgilash1Click(TObject *Sender)
    {
    Memo1->SelectAll();
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm3::Saqlash2Click(TObject *Sender)
    {
    if(SaveDialog1->Execute()){
    fileName=SaveDialog1->FileName + ".txt";
    Memo1->Lines->SaveToFile(fileName);
    Caption=ExtractFileName(fileName);
    }
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm3::Saqlash1Click(TObject *Sender)
    {
    if(fileName =="Yangi hujjat"){
    Saqlash2->Click();
    } else{
    Memo1->Lines->SaveToFile(fileName);
    }
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm3::Yangi2Click(TObject *Sender)
    {
    int abs = MessageDlg("O'zgarishlar saqlansinmi ?", mtInformation, TMsgDlgButtons()<if( abs == mrYes){
    Saqlash1->Click();
    if ( OpenDialog1->Execute()){
    fileName = OpenDialog1->FileName;
    Memo1->Lines->LoadFromFile(fileName);
    Caption = ExtractFileName(fileName);
    }
    } else if(abs == mrNo) {
    if ( OpenDialog1->Execute()){
    fileName = OpenDialog1->FileName;
    Memo1->Lines->LoadFromFile(fileName);
    Caption = ExtractFileName(fileName);
    }
    }
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm3::Yangi1Click(TObject *Sender)
    {
    int abs = MessageDlg("O'zgarishlar saqlansinmi ?", mtInformation, TMsgDlgButtons()<if( abs == mrYes){
    Saqlash1->Click();
    fileName ="Yangi hujjat";
    Caption = fileName;
    Memo1->Clear();
    } else if(abs == mrNo) {
    fileName ="Yangi hujjat";
    Caption = fileName;
    Memo1->Clear();
    }
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm3::Chiqish1Click(TObject *Sender)
    {
    Close();
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm3::FormClose(TObject *Sender, TCloseAction &Action)
    {
    if(Memo1->Modified){
    int abs = MessageDlg("O'zgarishlar saqlansinmi ?", mtInformation, TMsgDlgButtons()<if( abs == mrYes){
    Saqlash1->Click();
    } else if(abs == mrCancel) {
    Abort();
    }
    }
    else{
    Form3->Close();
    }
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm3::Dasturxaqida1Click(TObject *Sender)
    {
    Form1->ShowModal();
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm3::Yordam1Click(TObject *Sender)
    {
    ShowMessage("Dasturda muammolar bo'lsa abrorbekkamolov2@gmail.com ga murojat qiling");
    }
    //---------------------------------------------------------------------------

    Blaknotimiz tayyor!
    Download 400,54 Kb.




    Download 400,54 Kb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Gurux talabasi adhamjonova dilafruz. 2-dedline. Blaknot dasturini tayyorlash

    Download 400,54 Kb.