如何在鼠标所指的一个窗体边框上绘制一个矩形? 如何在鼠标所指的一个窗体边框上绘制一个矩形?用API--Rectangle吗?我应该如何用?(delphi)谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls;type TForm1 = class(TForm) Timer1: TTimer; procedure Timer1Timer(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } FOldHandle: THandle; public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Timer1Timer(Sender: TObject);const cWidth = 3;var vRect: TRect; vHandle: THandle; vBoxHandle: THandle;begin if Color = clWindow then Color := clBlue else Color := clWindow; vHandle := WindowFromPoint(Mouse.CursorPos); if vHandle = FOldHandle then Exit; FOldHandle := vHandle; if vHandle = Handle then begin Hide; Exit; end; Show; GetWindowRect(vHandle, vRect); Left := vRect.Left; Top := vRect.Top; Width := vRect.Right - vRect.Left; Height := vRect.Bottom - vRect.Top; vRect := BoundsRect; vHandle := CreateRectRgn(0, 0, Width, Height); vBoxHandle := CreateRectRgn(cWidth, cWidth, Width - cWidth, Height - cWidth); try CombineRgn(vHandle, vHandle, vBoxHandle, RGN_XOR); SetWindowRgn(Handle, vHandle, True); finally DeleteObject(vHandle); DeleteObject(vBoxHandle); end;end;procedure TForm1.FormCreate(Sender: TObject);begin Timer1.Interval := 500; Color := clBlue; BorderStyle := bsNone; FormStyle := fsStayOnTop; Application.ShowMainForm := False;end;end. 好像没有用啊,我的意思是说,像spy++那样鼠标指到哪,那就有一个绘制的矩形 如何指定打印机打印 有关DBGRID行的显示颜色问题 40是你的 我就要如此界面控件 如何对字符串format 关于面向对象的数据库程序设计,很头疼 help~~! 在线等待teamsource的serial number and key,谢谢 如何建立插件程序 socket 请问delphi地控制台程序(console application)里怎样访问sql数据库? FastReport2.47如何才能正确显示整形数据项? 如何在一个用户登陆程序里,只有当密码输入正确后才可以打开另一个EXE程序,而被开启的程序不能通过双击鼠标运行,
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;type
TForm1 = class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
FOldHandle: THandle;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Timer1Timer(Sender: TObject);
const
cWidth = 3;
var
vRect: TRect;
vHandle: THandle;
vBoxHandle: THandle;
begin
if Color = clWindow then
Color := clBlue
else Color := clWindow; vHandle := WindowFromPoint(Mouse.CursorPos);
if vHandle = FOldHandle then Exit;
FOldHandle := vHandle; if vHandle = Handle then begin
Hide;
Exit;
end;
Show;
GetWindowRect(vHandle, vRect);
Left := vRect.Left;
Top := vRect.Top;
Width := vRect.Right - vRect.Left;
Height := vRect.Bottom - vRect.Top; vRect := BoundsRect;
vHandle := CreateRectRgn(0, 0, Width, Height);
vBoxHandle := CreateRectRgn(cWidth, cWidth, Width - cWidth, Height - cWidth);
try
CombineRgn(vHandle, vHandle, vBoxHandle, RGN_XOR);
SetWindowRgn(Handle, vHandle, True);
finally
DeleteObject(vHandle);
DeleteObject(vBoxHandle);
end;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
Timer1.Interval := 500;
Color := clBlue;
BorderStyle := bsNone;
FormStyle := fsStayOnTop;
Application.ShowMainForm := False;
end;end.