Demo7Frm.cpp
上传用户:daoqigc
上传日期:2021-04-20
资源大小:2795k
文件大小:2k
- //---------------------------------------------------------------------------
- #include <vclvcl.h>
- #pragma hdrstop
- #include "MainFrm.h"
- #include "Demo7Frm.h"
- //---------------------------------------------------------------------------
- #pragma link "RVEdit"
- #pragma link "RichView"
- #pragma link "RVScroll"
- #pragma resource "*.dfm"
- TfrmDemo7 *frmDemo7;
- //---------------------------------------------------------------------------
- __fastcall TfrmDemo7::TfrmDemo7(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmDemo7::FormCreate(TObject *Sender)
- {
- rve->Clear();
- rve->LoadText(ExtractFilePath(Application->ExeName)+"MainFrm.cpp",0,0, false);
- rve->Format();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmDemo7::FormKeyDown(TObject *Sender, WORD &Key,
- TShiftState Shift)
- {
- if (Key==VK_ESCAPE)
- Close();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmDemo7::btnMarkClick(TObject *Sender)
- {
- rve->SetSelectionBounds(0,rve->GetOffsBeforeItem(0),0,rve->GetOffsBeforeItem(0));
- while (rve->SearchText(txt->Text, TRVESearchOptions()<<rvseoDown))
- rve->ApplyTextStyle(sncomMarked);
- // Note: every call of ApplyTextStyle reformats affected paragraphs
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmDemo7::btnUnmarkClick(TObject *Sender)
- {
- rve->SelectAll();
- rve->ApplyTextStyle(sncomNormal);
- rve->Deselect();
- rve->Refresh();
- }
- //---------------------------------------------------------------------------