В firemonkey (delphi tokyo), в чем разница между onResize
и onResized
событием Tcontrol? поскольку оба они называются ПОСЛЕ , размер элемента управления уже изменился. И самое главное, когда использовать onresized
, а когда использовать onresize
?
из исходного кода Delphi:
procedure TControl.SetBounds(X, Y, AWidth, AHeight: Single);
var
SizeChanged: Boolean;
Moved: Boolean;
NeedRepaint: Boolean;
ReductionSize: Boolean;
begin
Moved := not (SameValue(X, Position.X, TEpsilon.Position) and SameValue(Y, Position.Y, TEpsilon.Position));
SizeChanged := not (SameValue(AWidth, Width, TEpsilon.Position) and SameValue(AHeight, Height, TEpsilon.Position));
if Moved or SizeChanged then
begin
ReductionSize := False;
if SizeChanged then
begin
ReductionSize := (FSize.Height > AHeight) or (FSize.Width > AWidth);
SizeChanged := DoSetSize(FSize, False, AWidth, AHeight, FLastWidth, FLastHeight);
end;
NeedRepaint := False;
if Moved or (SizeChanged and (RotationAngle <> 0)) then
begin
if Moved or ReductionSize then
Repaint;
FPosition.SetPointNoChange(PointF(X, Y));
FLeft := FPosition.X;
FTop := FPosition.Y;
Inc(FUpdating);
try
MatrixChanged(Self);
finally
Dec(FUpdating);
end;
NeedRepaint := True;
end;
if Moved or SizeChanged then
begin
if (csDesigning in ComponentState) then
if (FParentControl <> nil) and not (csDestroying in FParentControl.ComponentState) then
if (TRectF.Union(BoundsRect, FParentControl.LocalRect) <> FParentControl.LocalRect) then
FParentControl.RecalcUpdateRect;
UpdateExplicitBounds;
UpdateAnchorRules;
RequestAlign;
end;
if not (csLoading in ComponentState) and SizeChanged then
begin
UpdateSmallSizeControl;
Resize;
if FControls <> nil then
Realign
else if HasEffect then
UpdateEffects;
end;
if not (csLoading in ComponentState) and not SizeChanged and Moved then
Move;
if not (csLoading in ComponentState) and (Moved or SizeChanged) then
begin
RecalcUpdateRect;
NeedRepaint := True;
end;
if not (csLoading in ComponentState) and SizeChanged then
DoResized;
if NeedRepaint then
Repaint;
end;
end;
Таким образом, изменение размера шва и DoResized называются ПОСЛЕ DoSetSize.