|
TCustomRichViewEdit.OnDrawCustomCaret |
Top Previous Next |
|
Allows to draw a custom caret. type TRVDrawCustomCaretEvent = procedure (Sender: TCustomRichViewEdit; Canvas: TCanvas; const Rect: TRect) of object; property OnDrawCustomCaret: TRVDrawCustomCaretEvent; (introduced in version 10) Custom caret is drawn if CustomCaretInterval>0. OnMeasureCustomCaret event occurs before each call of this event. Example This example draws a rectangle/ellipse caret. In combination with the example in OnMeasureCustomCaret topic, it draws rectangle/ellipse around the character to the right of the caret. procedure TMyForm.MyRichViewEditDrawCustomCaret(Sender: TCustomRichViewEdit; Canvas: TCanvas; const Rect: TRect); const f: Boolean=True; var r: TRect; begin if f then Canvas.Pen.Color := clRed else Canvas.Pen.Color := clBlue; f := not f; r := Rect; Canvas.Brush.Style := bsClear; if f then Canvas.Rectangle(r) else Canvas.Ellipse(r); end; |