Einzelnen Beitrag anzeigen

scp

Registriert seit: 31. Okt 2003
1.120 Beiträge
 
Delphi 7 Personal
 
#4

Re: Child-Formularbewegungen begrenzen

  Alt 11. Nov 2003, 17:15
So gehts jetzt, habs auch mit MDI getestet:

Delphi-Quellcode:
procedure TForm1.WMMove(var Message: TWMMove);
var
  ParentWnd : HWND;
  ParentCRect : TRect;
begin
  ParentWnd := GetParent(Handle);

  If (Message.XPos < 0) then
    Left := 0;
  If (Message.YPos < GetSystemMetrics(SM_CYCAPTION)) then
    Top := 0;


  If (ParentWnd <> 0) then
    begin
      Windows.GetClientRect(ParentWnd, ParentCRect);

      If (Message.XPos > (ParentCRect.Right - Width)) then
        Left := ParentCRect.Right - Width;
      If (Message.YPos > (ParentCRect.Bottom - Height - GetSystemMetrics(SM_CYCAPTION))) then
        Top := ParentCRect.Bottom - Height;
    end
  else
    begin
      If (Message.XPos > (Screen.Width - Width)) then
        Left := Screen.Width - Width;
      If (Message.YPos > (Screen.Height - Height - GetSystemMetrics(SM_CYCAPTION))) then
        Top := Screen.Height - Height - GetSystemMetrics(SM_CYCAPTION);
    end;


  Message.result := 0;
end;
  Mit Zitat antworten Zitat