CreateCaret {建立}
DestroyCaret {釋放}
ShowCaret {顯示}
HideCaret {隱藏}
SetCaretPos {設置位置}
GetCaretPos {獲取位置}
SetCaretBlinkTime {設置間隔時間}
GetCaretBlinkTime {獲取間隔時間}
簡單測試, 效果圖:
代碼文件:unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
CreateCaret(Handle, 0, 0, 20);
SetCaretPos(X, Y);
ShowCaret(Handle);
end;
end.
窗體文件:
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 176
ClientWidth = 298
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
OnMouseDown = FormMouseDown
PixelsPerInch = 96
TextHeight = 13
end