看到公司使用的技术,将某个窗体这样移到屏幕的某个位置的方法:
1.GetWindowRect首先获得窗体的Rect
BOOL GetWindowRect( HWND hWnd, LPRECT lpRect );
用法:
var
R: TRect;
begin
GetWindowRect(ReportForm.ParentHandle, R); //通过ReportForm的窗体句柄,获得其整个界面的Rect
end;
2.改变lprc矩形的源始坐标。
BOOL OffsetRect( LPRECT lprc, // rectangle int dx, // horizontal offset int dy // vertical offset );
用法:
OffsetRect(R, -R.Left, -R.Top);//往左,要使用负数 -dx;同理,往上移动,也要使用负数 -dy
3.使用vcl的属性(delphi