SRichViewEdit OnPaint
Posted: Mon May 21, 2012 11:21 am
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?
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?