随笔 - 2146  文章 - 97 评论 - 11767 trackbacks - 253

  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

posted on 2008-11-04 14:09  万一  阅读(...)  评论(...编辑  收藏