自己定义消息;
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
Const
WM_SETSIZE=WM_USER+100;
type
TForm1 = class(TForm)
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
Procedure ButWMSize(var Message:TMessage); Message WM_SETSIZE;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
Procedure TForm1.ButWMSize(var Message:TMessage);
begin
Form1.BitBtn2.Left:=100;
Form1.BitBtn2.Top:=100;
Form1.BitBtn2.Width:=50;
Form1.BitBtn2.Height:=50;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
SendMessage(Form1.Handle,WM_SETSIZE,0,0);
end;
end.