Unit1.pas
上传用户:daoqigc
上传日期:2021-04-20
资源大小:2795k
文件大小:2k
- unit Unit1;
- interface
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
- Dialogs, RVScroll, RichView, RVEdit, RVStyle, ImgList, StdCtrls, ComCtrls;
- type
- TForm1 = class(TForm)
- ImageList1: TImageList;
- RVStyle1: TRVStyle;
- RichViewEdit1: TRichViewEdit;
- ImageList2: TImageList;
- procedure FormCreate(Sender: TObject);
- procedure RichViewEdit1RVFImageListNeeded(Sender: TCustomRichView;
- ImageListTag: Integer; var il: TCustomImageList);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.dfm}
- {-------------------------------------------------------------------------------
- RVStyle1.ListStyles[0] has two levels -
- 0th - imagelistcounter
- 1st - imagelist
- -------------------------------------------------------------------------------}
- procedure TForm1.FormCreate(Sender: TObject);
- var i: Integer;
- const text = 'Text text text. Text text text text. Text text text. Text text text text. Text text text. Text text text text.';
- begin
- with RichViewEdit1 do begin
- Clear;
- for i := 1 to 5 do begin
- SetListMarkerInfo(-1, 0, 0, 1, 0, False);
- Add(text, 3);
- SetListMarkerInfo(-1, 0, 1, 1, 0, False);
- Add(text, 0);
- SetListMarkerInfo(-1, 0, 1, 1, 0, False);
- Add(text, 0);
- SetListMarkerInfo(-1, 0, 1, 1, 0, False);
- Add(text, 0);
- end;
- Format;
- end;
- end;
- // This event is not used in this demo.
- // But if you want to save and load this document in RVF, it is necessary.
- // Note: ImageList1.Tag is set to 1, ImageList2.Tag is set to 2.
- procedure TForm1.RichViewEdit1RVFImageListNeeded(Sender: TCustomRichView;
- ImageListTag: Integer; var il: TCustomImageList);
- begin
- case ImageListTag of
- 1: il := ImageList1;
- 2: il := ImageList2;
- end;
- end;
- end.