zoukankan      html  css  js  c++  java
  • 同步窗体移动 FormMove



    方法2


    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



      private
       procedure WMMOVE(var Msg: TMessage);  message WM_MOVE;

    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;







  • 相关阅读:
    HDU2767 Proving Equivalences
    POJ2771 Guardian of Decency
    POJ1111 Image Perimeters
    简单就好
    工具乃思维的奴隶
    “年终奖”
    学点经济学知识(二)
    被忽略的技能
    猿类己见
    学点经济学知识(一)
  • 原文地址:https://www.cnblogs.com/xe2011/p/3717696.html
Copyright © 2011-2022 走看看