...move your form by clicking anywhere?

Author: Matthias

Category: Forms


private
  procedure 
WMNCHitTest(var msg: TWMNCHitTest); message WM_NCHITTEST;
end;

var
  
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.WMNCHitTest(var msg: TWMNCHitTest);
begin
  inherited
;
  if msg.Result = htClient then
    
msg.Result := htCaption;
end;
{...}



{ ************************* }
{ Or / Oder: }

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
const 
  
SC_DRAGMOVE = $F012;
begin
  if 
Button = mbleft then
  begin
    
ReleaseCapture;
    Form1.Perform(WM_SYSCOMMAND, SC_DRAGMOVE, 0);
  end;
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base