Demo6Frm.cpp
上传用户:daoqigc
上传日期:2021-04-20
资源大小:2795k
文件大小:2k
源码类别:

RichEdit

开发平台:

Delphi

  1. //---------------------------------------------------------------------------
  2. #include <vclvcl.h>
  3. #pragma hdrstop
  4. #include "Demo6Frm.h"
  5. //---------------------------------------------------------------------------
  6. #pragma link "RichView"
  7. #pragma link "RVScroll"
  8. #pragma link "RVStyle"
  9. #pragma resource "*.dfm"
  10. TfrmDemo6 *frmDemo6;
  11. //---------------------------------------------------------------------------
  12. __fastcall TfrmDemo6::TfrmDemo6(TComponent* Owner)
  13.     : TForm(Owner)
  14. {
  15. }
  16. //---------------------------------------------------------------------------
  17. void __fastcall TfrmDemo6::FormCreate(TObject *Sender)
  18. {
  19.   ImageIndex = 0;
  20.   Red  = 150;
  21.   DRed = 5;
  22.   rvs->TextStyles->Items[rvsHeading]->Color = (TColor)RGB(Red,0,0);
  23.   // How many items the following statements adds? (adding string with 10 "rn"?)
  24.   // Answer: 11! because it is considered like
  25.   // ""+"rn"+""+"rn"+""+"rn"+""+"rn"+""+"rn"+""+"rn"+""+"rn"+""+
  26.   // +"rn"+""+"rn"+""+"rn"+""
  27.   rv->AddTextNL("rnrnrnrnrnrnrnrnrnrn", 0,0,0);
  28.   // And since v1.1 you can use TopMargin and BottomMargin properties instead of
  29.   // adding empty lines!
  30.   rv->AddBulletEx("",0,il,1);
  31.   rv->Add("Credits Demo", 1);
  32.   rv->AddTextNL(
  33.         "Roberto Nelsonrn"
  34.         "Bruce Youngrn"
  35.         "Kim Lambertrn"
  36.         "Leslie Johnsonrn"
  37.         "Phil Forestrn"
  38.         "K.J. Westonrn"
  39.         "Lee Terryrn"
  40.         "Stewart Hallrn"
  41.         "Katherine Youngrn"
  42.         "Chris Papadopulosrn"
  43.         "Pete Fisherrn"
  44.         "Ann Bennetrn"
  45.         "Roger De Sousarn"
  46.         "Janet Boldwinrn"
  47.         "Roger Reevesrn"
  48.         "Willie Stansburyrn"
  49.         "Leslie Phongrn"
  50.         "Ashok Ramanathan",0,0,0);
  51.   rv->AddNL("and other people from Employee.db",2,0);
  52.   rv->AddTextNL("rnrnrnrnrnrnrnrnrnrn", 0,0,0);
  53.   rv->VSmallStep = 1;
  54.   rv->Format();
  55. }
  56. //---------------------------------------------------------------------------
  57. void __fastcall TfrmDemo6::tmrTimer(TObject *Sender)
  58. {
  59.    if (rv->VScrollPos!=rv->VScrollMax)
  60.      rv->VScrollPos = rv->VScrollPos+1;
  61.    else
  62.      rv->VScrollPos = 0;
  63.    Red += DRed;
  64.    rvs->TextStyles->Items[rvsHeading]->Color = (TColor)RGB(Red,0,0);
  65.    if (Red==255 || Red==100)
  66.      DRed = (char)-DRed;
  67.    if (++ImageIndex == il->Count)
  68.      ImageIndex = 0;
  69.    rv->SetBulletInfo(11,"",ImageIndex,NULL,0);
  70. }
  71. //---------------------------------------------------------------------------