快捷搜索:

WinAPI: 输入光标相关的函数[1]

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

您可能还会对下面的文章感兴趣: