unit1.pas
来自「delphi查询指定控件高度宽度等信息的源码」· PAS 代码 · 共 40 行
PAS
40 行
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
r: TRect;
a:HWND;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
a := FindWindow('TXGuiFoundation','QQ2009 Beta2');
Windows.GetClientRect(a, r);
Label1.Caption := Format('%d,%d,%d,%d', [r.Left,r.Top,r.Right,r.Bottom]); //句柄窗体在父句柄中的位置,窗体长宽
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?