unit1.cpp

来自「<<C++Builder 6实用编程100例>>随书光盘」· C++ 代码 · 共 52 行

CPP
52
字号
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::OpenClick(TObject *Sender)
{
        if(OpenDialog1->Execute())
                RichEdit1->Lines->LoadFromFile(OpenDialog1->FileName);                
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ExitClick(TObject *Sender)
{
        Form1->Close();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FontSetupClick(TObject *Sender)
{
        FontDialog1->Options<<fdApplyButton;
        if(FontDialog1->Execute())
                RichEdit1->SelAttributes->Assign(FontDialog1->Font);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FontDialog1Apply(TObject *Sender, HWND Wnd)
{
        RichEdit1->SelAttributes->Assign(FontDialog1->Font);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::BackColorClick(TObject *Sender)
{
        if(ColorDialog1->Execute())
                RichEdit1->Color=ColorDialog1->Color;
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?