2006. december 24., vasárnap

Move components on a form during runtime


Problem/Question/Abstract:

Move components on a form during runtime

Answer:

Moves misc. components on a form, e.g. TButton, TLabel, etc. Put the call in the components OnMouseDown-Eventhandler;
  
Example: MoveObject(Sender, X, Y);

uses
  Windows, Messages;

procedure MoveObject(Sender: TObject; X, Y: Integer);
const
  SC_DragMove = $F012;
begin
  ReleaseCapture;
  (Sender as TControl).Perform(WM_SysCommand, SC_DragMove, 0);
end;

Nincsenek megjegyzések:

Megjegyzés küldése