怎样在点住Panel或Image时能够拖动整个窗口?(50分)

  • 主题发起人 主题发起人 newhzh
  • 开始时间 开始时间
N

newhzh

Unregistered / Unconfirmed
GUEST, unregistred user!
怎样在点住Panel或Image时能够拖动整个窗口?
谢谢
 
type
TForm1=class(TForm)
Image1: TImage;
Panel1: TPanel;
private
procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;
public
end;

....

procedure TForm1.WMNCHitTest(var Message: TWMNCHitTest);
var
pt: TPoint;
begin
inherited;
pt := ScreenToClient(SmallPointToPoint(Message.Pos));
if (GetAsyncKeyState(VK_LEFT) < 0) and (ptinrect(Panel1.BoundsRect,Pt) or ptinrect(Image1.BoundsRect, pt)) then
message.result := HTCAPTION;
end;
 
接受答案了.
 
后退
顶部