Ver Mensaje Individual
  #2  
Antiguo 24-12-2006
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicación: Ciudad de México
Posts: 20.269
Reputación: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
Extraño requerimiento pero puedes intentarlo interceptando el mensaje WM_MOVING del formulario hijo:

Código Delphi [-]
type
  TForm2 = class(TForm)
  private
    procedure WMMoving(var Msg: TWMMoving); message WM_MOVING;
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

{ TForm2 }

procedure TForm2.WMMoving(var Msg: TWMMoving);
var
  DragWidth: Integer;
  DragHeight: Integer;

begin
  inherited;

  DragWidth := Msg.DragRect.Right - Msg.DragRect.Left;
  DragHeight := Msg.DragRect.Bottom - Msg.DragRect.Top;

  with Msg, Application.MainForm do
  begin
    if DragRect.Left - 2 <= ClientOrigin.X then
    begin
      DragRect.Left := ClientOrigin.X + 2;
      DragRect.Right := ClientOrigin.X + DragWidth + 2;
    end;

    if DragRect.Right + 2 > ClientOrigin.X + ClientWidth then
    begin
      DragRect.Left := ClientOrigin.X + ClientWidth - DragWidth - 2;
      DragRect.Right := ClientOrigin.X + ClientWidth - 2;
    end;

    if DragRect.Top - 2 <= ClientOrigin.Y then
    begin
      DragRect.Top := ClientOrigin.Y + 2;
      DragRect.Bottom := ClientOrigin.Y + DragHeight + 2;
    end;

    if DragRect.Bottom + 2 > ClientOrigin.Y + ClientHeight then
    begin
      DragRect.Top := ClientOrigin.Y + ClientHeight - DragHeight - 2;
      DragRect.Bottom := ClientOrigin.Y + ClientHeight - 2;
    end;
  end;
end;

Claro que tendrías que hacer lo mismo para cada formulario hijo, o bien hacerlo para un formulario hijo base y heredar todos los demás de ése.

// Saludos
Responder Con Cita