ClientToScreen这函数没什么问题吧,你这样测试一下:
//移动form
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.Text:=IntToStr(ClientToScreen(Panel1.BoundsRect.TopLeft).X);
Edit2.Text:=IntToStr(ClientToScreen(Panel1.BoundsRect.TopLeft).Y);
Edit3.Text:=IntToStr(ClientToScreen(Panel1.BoundsRect.BottomRight).X);
Edit4.Text:=IntToStr(ClientToScreen(Panel1.BoundsRect.BottomRight).Y);
end;
//移动Panel1
procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
TControl(Sender).Perform(WM_SYSCOMMAND,$F012,0);
Edit1.Text:=IntToStr(ClientToScreen(Panel1.BoundsRect.TopLeft).X);
Edit2.Text:=IntToStr(ClientToScreen(Panel1.BoundsRect.TopLeft).Y);
Edit3.Text:=IntToStr(ClientToScreen(Panel1.BoundsRect.BottomRight).X);
Edit4.Text:=IntToStr(ClientToScreen(Panel1.BoundsRect.BottomRight).Y);
end;