Delphi调用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

时间: 2024-10-04 16:33:26

Delphi调用WinAPI: 输入光标相关的函数[1]的相关文章

Delphi调用WinAPI: 输入光标相关的函数[3]

本例测试修改光标的形色, 效果图: 代码文件:unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) RadioGroup1: TRadioGroup; procedure FormCreate(Sender: TObject); proc

Delphi调用WinAPI: 输入光标相关的函数[2]

本例测试修改光标的设置闪烁速度, 注意这会影响到其他程序, 退出时应恢复到系统 默认的 530 毫秒. 本例效果图: 代码文件:unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) RadioGroup1: TRadioGroup; pr

Delphi调用WinAPI: 输入光标相关的函数[4]

本例效果图: 代码文件: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); p

Delphi调用WinAPI 字符及字符串函数(14): CharToOem、OemToChar

CharToOemBuff.OemToCharBuff 与 CharToOem.OemToChar 的区别只是前者可以指 定要转换的字符数.unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButt

Delphi调用WinAPI 字符及字符串函数(13)

lstrcmp.lstrcmpi - 对比串 lstrcmp 区分大小写; lstrcmpi 不区分大小写. 返回值: -1.0.1, 其中 0 表示相 同. unit Unit1;interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Butto

Delphi调用WinAPI 字符及字符串函数(12): lstrlen

unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Se

Delphi调用WinAPI 字符及字符串函数(11)

lstrcpyn - 复制字符串, 同时指定要复制的长度 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); end; var Form1

Delphi调用WinAPI 字符及字符串函数(10)

lstrcpy - 复制字符串 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Button3: TButton; procedure Button1Click(Sender: T

Delphi调用WinAPI 字符及字符串函数(9)

lstrcat - 合并字符串 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; procedure Butt