PopupFrm.cpp
上传用户:daoqigc
上传日期:2021-04-20
资源大小:2795k
文件大小:3k
- //---------------------------------------------------------------------------
- #include <vclvcl.h>
- #pragma hdrstop
- #include "PopupFrm.h"
- #include "MainFrm.h"
- //---------------------------------------------------------------------------
- #pragma link "RichView"
- #pragma link "RVScroll"
- #pragma link "RVStyle"
- #pragma resource "*.dfm"
- TfrmPopup *frmPopup;
- //---------------------------------------------------------------------------
- __fastcall TfrmPopup::TfrmPopup(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- void TfrmPopup::Build(int DemoNo)
- {
- switch (DemoNo)
- {
- case 1:
- {
- rv->AddBulletEx("",1,frmMain->il,1);
- rv->Add("'Checkpoints'", 1);
- rv->AddNL("Synchronizing document scrolling with list of contents", 0,0);
- rv->AddNL("(This demo loads *.cpp files from application directory)", 0,0);
- break;
- }
- case 2:
- {
- rv->AddBulletEx("",1,frmMain->il,1);
- rv->Add("Customizing Styles", 1);
- rv->AddNL("Interactive customizing of document", 0,0);
- break;
- }
- case 3:
- {
- rv->AddBulletEx("",1,frmMain->il,1);
- rv->Add("Query Summary", 1);
- rv->AddNL("Complex query at one look", 0,0);
- break;
- }
- case 4:
- {
- rv->AddBulletEx("",1,frmMain->il,1);
- rv->Add("Interactive document", 1);
- rv->AddNL("Document is a control itself", 0,0);
- break;
- }
- case 5:
- {
- rv->AddBulletEx("",1,frmMain->il,1);
- rv->Add("Chat Simulation", 1);
- rv->AddNL("Autoscroll, URL detection", 0,0);
- break;
- }
- case 6:
- {
- rv->AddBulletEx("",1,frmMain->il,1);
- rv->Add("Credits Demo:", 1);
- rv->AddNL("Scrolling text and images on timer", 0,0);
- break;
- }
- case 7:
- {
- rv->AddBulletEx("",1,frmMain->il,1);
- rv->Add("Search and mark:", 1);
- rv->AddNL("Search and mark words in editor", 0,0);
- rv->AddNL("(This demo loads MainFrm.cpp from application directory)", 0,0);
- break;
- }
- }
- rv->Format();
- Height = rv->DocumentHeight+20;
- }
- //---------------------------------------------------------------------------
- void TfrmPopup::MoveToMouse()
- {
- TPoint p;
- GetCursorPos(&p);
- if (p.x+Width>Screen->Width)
- p.x = Screen->Width-Width;
- if (p.y+Height>Screen->Height)
- p.y = Screen->Height-Height;
- Left = p.x;
- Top = p.y;
- }
- //---------------------------------------------------------------------------
- void TfrmPopup::ShowTopic(int DemoNo)
- {
- Build(DemoNo);
- MoveToMouse();
- Show();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmPopup::FormKeyPress(TObject *Sender, char &Key)
- {
- Key = 0;
- Close();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmPopup::rvClick(TObject *Sender)
- {
- Close();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmPopup::FormDeactivate(TObject *Sender)
- {
- Close();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmPopup::FormClose(TObject *Sender, TCloseAction &Action)
- {
- Action = caFree;
- }
- //---------------------------------------------------------------------------