procedure TbsBusinessSkinForm.DoMagnetic;
var
R: TRect;
LW, TR: Integer;
P: TPoint;
begin
if FForm.FormStyle <> fsMDIChild
then
SystemParametersInfo(SPI_GETWORKAREA, 0, @R, 0)
else
begin
R := GetMDIWorkArea;
P := Application.MainForm.ClientToScreen(Point(0, 0));
OffsetRect(R, P.X, P.Y);
end;
if (L < R.Left + FMagneticSize) and (L > R.Left - FMagneticSize)
then L := R.Left;
if (T < R.Top + FMagneticSize) and (T > R.Top - FMagneticSize)
then T := R.Top;
LW := L + W; TR := T + H;
if (LW > R.Right - FMagneticSize) and (LW < R.Right + FMagneticSize)
then L := R.Right - W;
if (TR > R.Bottom - FMagneticSize) and (TR < R.Bottom + FMagneticSize)
then T := R.Bottom - H;
end;
你看看这段对你有没有帮助吧