in SRV demo's ActionTestTabs, open two or more rvf file, on SRVTabSet click someone tabitem, I try to get current tabitem's CurItemNo with CaretPos, and draw a line, use code by SRichViewEdit1.OnPaint event:
procedure TForm3.ActiveEditorPaint(Sender: TSRichViewEdit; Canvas: TCanvas; Prepaint: Boolean; PaintRect: TRect);
var y: Integer;
begin
if not vdrawline then exit;
y:= ActiveEditor.CaretPos.Y;
Canvas.Pen.Color := clRed;
Canvas.Pen.Width := 1;
Canvas.Pen.Style:= psdot;
Canvas.MoveTo(0,y);
Canvas.LineTo(ClientWidth,y);
edit1.Text:= inttostr(ActiveEditor.ActiveEditor.CurItemNo);
end;
it act only in tabitem1,how can i do it with ActiveEditorPaint in other tabitems?
SRichViewEdit OnPaint
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
This demo works in the following way.
Initially, only one editor is available, SRichViewEdit1.
Next, the user can create new editors. Properties and events of new editors are assigned in TForm3.AddEditor procedure.
(Next, the user can close some tabs and thus destroy some editors, including SRichViewEdit1)
What you need to do.
1) At design time, assign SRichViewEdit1.OnPaint
2) in TForm3.AddEditor, add the line
Initially, only one editor is available, SRichViewEdit1.
Next, the user can create new editors. Properties and events of new editors are assigned in TForm3.AddEditor procedure.
(Next, the user can close some tabs and thus destroy some editors, including SRichViewEdit1)
What you need to do.
1) At design time, assign SRichViewEdit1.OnPaint
2) in TForm3.AddEditor, add the line
Code: Select all
srve.OnPaint := ActiveEditorPaint;
in TForm3.AddEditor, add the line
it is OK,i got it,think you!
Code: Select all
srve.OnPaint := ActiveEditorPaint;