码迷,mamicode.com
首页 > 移动开发 > 详细

同步窗体移动

时间:2014-05-09 08:45:39      阅读:315      评论:0      收藏:0      [点我收藏+]

标签:style   blog   class   code   ext   color   



方法2

bubuko.com,布布扣

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
  System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls;

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    procedure FormShow(Sender: TObject);
  private
    procedure WMMOVE(var Msg: TMessage); message WM_MOVE;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses Unit2;

procedure TForm1.FormShow(Sender: TObject);
begin
  Form2.Visible := true;
end;

procedure TForm1.WMMOVE(var Msg: TMessage);
begin
  inherited;
  try
    Form2.Parent:=Panel1;
    Form2.Left:=0;
    Form2.Top:=0;
    Form2.Align:=alClient;

  except

  end;
end;

end.


方法1

bubuko.com,布布扣


unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls;

type
  TForm1 = class(TForm)
    Panel1: TPanel;
  private
   procedure WMMOVE(var Msg: TMessage);  message WM_MOVE;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses Unit2;

procedure TForm1.WMMOVE(var Msg: TMessage);
begin
  inherited;
  try
    form2.Width :=  Panel1.Width;
    form2.Height := Panel1.Height;

    form2.left := Form1.left + Panel1.Left;
    form2.Top := Form1.Top + Panel1.Top;
  except

  end;
end;
end.






附件列表

     

    同步窗体移动,布布扣,bubuko.com

    同步窗体移动

    标签:style   blog   class   code   ext   color   

    原文地址:http://www.cnblogs.com/xe2011/p/3717696.html

    (0)
    (0)
       
    举报
    评论 一句话评论(0
    登录后才能评论!
    © 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
    迷上了代码!