function IsMouseOverControl(
const ctrl: TControl): boolean;
var
sr: TRect;
begin
sr := Rect(ctrl.ClientToScreen(Point(0, 0)), ctrl.ClientToScreen(Point(ctrl.Width, ctrl.Height)));
result := PtInRect(sr, Mouse.CursorPos);
end;
procedure TFormSettingKo.TimerZoomTimer(Sender: TObject);
var
YD, XD, YG: Integer;
SY, Y: Integer;
F: Boolean;
begin
YD := odDesignerKo.Top + odDesignerKo.Height;
XD := odDesignerKo.Left;
YG := GroupBoxZoom.Top - 12;
SY := GroupBoxZoom.Height;
GroupBoxZoom.Parent := odDesignerKo.Parent;
GroupBoxZoom.Left := XD;
Y := YD - YG;
if (IsMouseOverControl(GroupBoxZoom))
and (IsMouseOverControl(Self))
then
begin
F := Y <> SY;
Y := Min(Y, SY);
if F
then
begin
GroupBoxZoom.Width := Round(200 * (Y / SY));
TimerZoom.Interval := 1;
Inc(Y);
end
else
TimerZoom.Interval := 1000;
GroupBoxZoom.Top := YD - Y + 12;
GroupBoxZoom.Left := XD;
end
else
begin
F := Y <> 12;
Y := Max(Y, 12);
if F
then
begin
GroupBoxZoom.Width := Round(40 * (Y / 12));
TimerZoom.Interval := 1;
Dec(Y);
end
else
TimerZoom.Interval := 1000;
GroupBoxZoom.Top := YD - Y + 12;
GroupBoxZoom.Left := XD;
end;
CheckBoxZoomAuto.Visible := GroupBoxZoom.Width > 60;
GroupBoxZoom.Visible := True;
GroupBoxZoom.BringToFront;
end;