// Form2 wird links oben an Form1 "geklebt".


// Getestet mit D4 unter XP
 

unit Unit1; 
 
interface 
 
uses 
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs; 
 
type 
  TForm1 = class(TForm) 
    procedure FormShow(Sender: TObject); 
    procedure FormResize(Sender: TObject); 
    procedure FormActivate(Sender: TObject); 
  private 
    { Private-Deklarationen } 
  public 
    procedure WMMoving(var Msg: TMsg); message WM_MOVING; 
    procedure F2setzen; 
  end; 
 
var 
  Form1: TForm1; 
 
implementation 
 
uses Unit2; 
 
{$R *.DFM} 
{$R xpstyle.res} // siehe http://www.dbrsoftware.de/delphi/xpstyle.php 
 
procedure TForm1.F2setzen; 
begin 
  Form2.setbounds(left - Form2.width, top, Form2.width, Form2.height); 
end; 
 
procedure TForm1.WMMoving(var MSG: TMSG); 
begin 
  inherited; 
  F2setzen; 
end; 
 
procedure TForm1.FormShow(Sender: TObject); 
begin 
  Form2.show; 
  F2setzen; 
end; 
 
procedure TForm1.FormResize(Sender: TObject); 
begin 
  F2setzen; 
end; 
 
procedure TForm1.FormActivate(Sender: TObject); 
begin 
  sendmessage(Form2.handle, WM_NCACTIVATE, 1, 0); 
end; 
 
end.

//============================================================================
 

unit Unit2; 
 
interface 
 
uses 
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs; 
 
type 
  TForm2 = class(TForm) 
    procedure FormResize(Sender: TObject); 
    procedure FormActivate(Sender: TObject); 
  private 
    { Private-Deklarationen } 
  public 
    procedure WMMoving(var Msg: TMsg); message WM_MOVING; 
    procedure F1setzen; 
  end; 
 
var 
  Form2: TForm2; 
 
implementation 
 
uses Unit1; 
 
{$R *.DFM} 
 
procedure TForm2.F1setzen; 
begin 
  Form1.setbounds(boundsrect.right, top, Form1.width, Form1.height); 
end; 
 
procedure TForm2.WMMoving(var MSG: TMSG); 
begin 
  inherited; 
  F1setzen; 
end; 
 
procedure TForm2.FormResize(Sender: TObject); 
begin 
  F1setzen; 
end; 
 
procedure TForm2.FormActivate(Sender: TObject); 
begin 
  sendmessage(Form1.handle, WM_NCACTIVATE, 1, 0); 
end; 
 
end. 


 

Zugriffe seit 6.9.2001 auf Delphi-Ecke