delphi 鼠标跟随代码


本文整理自网络,侵删。

 unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls;

type
TForm1 = class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject);
var
px,py : Integer;
Pscreen : hdc;
can : tcanvas;
p : TPoint;
begin
Pscreen:=getdc(0);
can:=tcanvas.Create;
can.Handle:=Pscreen;
can.Brush.style:=bsclear;
can.Pen.color:=clwindow;
can.Pen.Width := 8;
GetCursorPos(P); //得到鼠标坐标
px := p.X;
py := p.Y;
can.Ellipse(px-3,py-3,px+3,py+3);
can.Free;
releasedc(0,Pscreen);
end;

运行该程序后,关闭该程序的操作步骤如下:
步骤1:按<Ctrl+Alt+Delete>键。
步骤2:单击“任务管理器”按钮。
步骤3:选中该程序的可执行文件“Project1”,单击“结束进程”即可。

相关阅读 >>

Delphi + word = 数据库 + 公文处理

Delphi winapi: gettopwindow - 获取指定窗口的子窗口中最顶层的窗口句柄

Delphi memo1 自定义位置插入

Delphi winsock远程唤醒计算机的函数

Delphi 跨平台的,在fmx中读取icon文件的每一帧到bitmap

Delphi blockread和blockwrite读写文件

Delphi使用tclientdataset时不携带midas.dll的方法

Delphi 获取汉字拼音首字母

Delphi idhttp中get与post的区别

Delphi guid单元

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...