Win32, TabControl: Revert r62366 #dfdf67a3f0 PageRect is relative to ClientBounds

git-svn-id: trunk@62625 -
This commit is contained in:
martin 2020-02-12 20:07:00 +00:00
parent 994832ca3e
commit f5871c4345

View File

@ -615,8 +615,11 @@ var
hittestInfo: TC_HITTESTINFO; hittestInfo: TC_HITTESTINFO;
Orect: TRect; Orect: TRect;
begin begin
if ATabControl is TTabControl then if ATabControl is TTabControl then begin
exit(0); Result := 0;;
exit;
end;
GetLCLClientBoundsOffset(ATabControl, ORect); GetLCLClientBoundsOffset(ATabControl, ORect);
hittestInfo.pt.x := AClientPos.x + ORect.Left; hittestInfo.pt.x := AClientPos.x + ORect.Left;
hittestInfo.pt.y := AClientPos.y + ORect.Top; hittestInfo.pt.y := AClientPos.y + ORect.Top;
@ -625,6 +628,8 @@ end;
class function TWin32WSCustomTabControl.GetTabRect(const ATabControl: TCustomTabControl; class function TWin32WSCustomTabControl.GetTabRect(const ATabControl: TCustomTabControl;
const AIndex: Integer): TRect; const AIndex: Integer): TRect;
var
Orect: TRect;
begin begin
if ATabControl is TTabControl then begin if ATabControl is TTabControl then begin
Result.Top := 0;; Result.Top := 0;;
@ -633,8 +638,16 @@ begin
Result.Right := 0;; Result.Right := 0;;
exit; exit;
end; end;
if Windows.SendMessage(ATabControl.Handle, TCM_GETITEMRECT, WPARAM(AIndex), LPARAM(@Result)) = 0
then GetLCLClientBoundsOffset(ATabControl, ORect);
if Windows.SendMessage(ATabControl.Handle, TCM_GETITEMRECT, WPARAM(AIndex), LPARAM(@Result)) <> 0
then begin
Result.Top := Result.Top - Orect.Top;
Result.Bottom := Result.Bottom - Orect.Top;
Result.Left := Result.Left - Orect.Left;
Result.Right := Result.Right - Orect.Left;
end
else
Result := inherited GetTabRect(ATabControl, AIndex); Result := inherited GetTabRect(ATabControl, AIndex);
end; end;