不可移动的窗口示例代码

2008-02-23 07:19:35来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

unit Unit1;
interface
uses


Windows Messages SysUtils Classes Graphics Controls Forms
Dialogs
StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
OldLeft OldTop OldWidth OldHeight: Integer;
public
{ Public declarations }
protected
procedure WMMOVING(var msg: TMessage);message WM_MOVING;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.WMMOVING(var msg: TMessage);
var
rect: ^TRect;
begin
label1.Caption := IntToStr(msg.WParam);
rect := Pointer(msg.LParam);
Label2.Caption := IntToStr(rect.Left);
Label3.Caption := IntToStr(rect.Top);
Label4.Caption := IntToStr(rect.Right);
Label5.Caption := IntToStr(rect.Bottom);
rect.Left := OldLeft;
rect.Top := OldTop;
rect.Right := rect.Left OldWidth;
rect.Bottom := rect.Top OldHeight;

msg.Result := 0;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
OldLeft := Left;
OldTop := Top;
OldWidth := Width;
OldHeight := Height;
end;
end.,

上一篇: Delphi“流”实现文件加密器
下一篇: Delphi实现窗体控件自由摆布

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:自制替换指定串函数

下一篇:Delphi中的窗体移动