Ver Mensaje Individual
  #4  
Antiguo 01-08-2008
santus santus is offline
Miembro
 
Registrado: ene 2006
Posts: 130
Reputación: 19
santus Va por buen camino
excelente!!!

Gracias Neftali.
Me funcionó de diez el ejemplo de tu página.

Lo unico que hice fue agregarle el mensaje al formulario principal, y que se acomoden las posiciones del segundo. Por si a alguien le interesa, quedaría algo asi:

Código Delphi [-]
unit uMain;
...
private
   procedure WMWindowPosChanging(var Message: TWMWindowPosChanging); message WM_WINDOWPOSCHANGING;
...
implementation

...
// evento OnMouseDown del formulario.
// esto sirve para mover el formulario de tipo BorderStyle = bsNone.
procedure TfMain.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
const
  SC_DRAGMOVE = $F012;
begin
  ReleaseCapture;
  Perform(WM_SYSCOMMAND, SC_DRAGMOVE, Integer(PointToSmallPoint(Point(X,Y))));
end;


// actualiza la posición del segundo form cuando lo movemos.
procedure TfMain.WMWindowPosChanging(var Message: TWMWindowPosChanging);
begin
  inherited;
  if (Assigned(form2)) and (form2.Visible) then
    form2.acomodarVentana;
end;
...

Y en el segundo formulario:

Código Delphi [-]
unit unit2;
...
public
    procedure acomodarVentana;
...
implementation
...

// elegimos a donde va el form. En mi caso, que lo muestre a la izq.
procedure TForm2.acomodarVentana;
begin
  Self.Top := fMain.Top;
  Self.Left := fMain.Left - Self.Width;
end;
...

Si al moverlo se ve el efecto del parpadeo en el formulario, simplemente agregar al evento OnCreate del form2:

Código Delphi [-]
   Self.DoubleBuffered := true;

En fin. Gracias Neftali por tu ayuda. Me ha venido muy bien, ya que no sabía como seguir. Hasta llegue a pensar que simplemente no se podia hacer esto. Y gracias tambien a todos los que se tomaron el trabajo de intentar entenderme!!

Saludos.
__________________
"El ordenador nació para resolver problemas que antes no existían." Bill Gates.
Responder Con Cita