Delphi, RadStudio
[delphi] 캡션없는 폼 드래그로 이동하기
SB리치퍼슨
2016. 10. 13. 21:35
[delphi] 캡션없는 폼 드래그로 이동하기
폼의 캡션을 사용하지 않거나 캡션이 없는 폼을 이동하는 방법입니다.
폼에 WMNCHitTest 윈도우 메시지 핸들러를 오버라이딩 해서 처리합니다.
TForm1 = class(TForm)
...
procedure WMNCHitTest( Var M: TWMNCHitTest );
message WM_NCHITTEST;
...
end;
implementation
...
procedure TForm1.WMNCHitTest(var M: TWMNCHitTest);
begin
inherited; // call the inherited message handler
if M.Result = htClient then // is the click in the client area?
M.Result := htcaption; // if so, make Windows think it's
// on the caption bar.
end;
반응형