anchor.diff:  var
     I: Integer;
   begin
  -  Result.Left := 0; //Its fine to have 0 here
  -  Result.Top := 0;
  -  Result.Right := Width;
  -  Result.Bottom := Height;
  -  for I := 0 to ChildCount - 1 do
  -  begin
  -    if not Childs[I].IsPainted then
  +  Result := KMRECT_ZERO; //Zero rect, by default
  +
  +  for I := 0 to fChildsPanel.ChildCount - 1 do
  +  begin
  +    if not fChildsPanel.Childs[I].IsPainted then
         Continue;
   
  -    if Childs[I].Left < Result.Left then
  +    if fChildsPanel.Childs[I].Left < Result.Left then
         Result.Left := Childs[I].Left;
   
  -    if Childs[I].Top < Result.Top then
  -      Result.Top := Childs[I].Top;
  -
  -    if Childs[I].Right > Result.Right then
  -      Result.Right := Childs[I].Right;
  -
  -    if Childs[I].Bottom > Result.Bottom then
  -      Result.Bottom := Childs[I].Bottom;
  +    if fChildsPanel.Childs[I].Top < Result.Top then
  +      Result.Top := fChildsPanel.Childs[I].Top;
  +
  +    if fChildsPanel.Childs[I].Right > Result.Right then
  +      Result.Right := fChildsPanel.Childs[I].Right;
  +
  +    if fChildsPanel.Childs[I].Bottom > Result.Bottom then
  +      Result.Bottom := fChildsPanel.Childs[I].Bottom;
     end;
   end;
   
  
positive.code: procedure TKMScrollPanel.UpdateScrollH(Sender: TObject; aValue: Integer);
  begin
    if (Sender <> fScrollBarH) then
      UpdateScrollH(nil);
  end;
  
  
  procedure TKMScrollPanel.UpdateScrollH(Sender: TObject);
  var
    ChildsRect: TKMRect;
    NewPos: Integer;
    ShowScroll: Boolean;
  begin
    ChildsRect := GetChildsRect;
    ShowScroll := False;
  
    if (saHorizontal in fScrollAxisSet) then
    begin
      if KMRectWidth(ChildsRect) + fPadding.Left + fPadding.Right > KMRectWidth(fClipRect) then
      begin
        fScrollBarH.MaxValue := KMRectWidth(ChildsRect) - KMRectWidth(fClipRect) + fPadding.Left + fPadding.Right;
        NewPos := fClipRect.Left - Left;
  
        if NewPos > fScrollBarH.MaxValue then
          fLeft := Left + NewPos - fScrollBarH.MaxValue; //Slightly move panel to the top, when resize near maxvalue position
        ShowScroll := True;
      end else begin
        fScrollBarH.Position := 0;
        if Left <> fClipRect.Left then
          fLeft := fClipRect.Left; //Set directrly to avoid SetLeft call
      end;
    end;
  
    fScrollBarH.Width := Width;
    if ShowScroll <> fScrollBarH.Visible then
      fScrollBarH.Visible := ShowScroll;
  end;
  
  
  procedure TKMScrollPanel.UpdateScrollV(Sender: TObject; aValue: Integer);
  begin
    if (Sender <> fScrollBarV) then
      UpdateScrollV(nil)
  end;
  
  
  procedure TKMScrollPanel.UpdateScrollV(Sender: TObject);
  var
    ChildsRect: TKMRect;
    NewPos: Integer;
    ShowScroll: Boolean;
  begin
    ChildsRect := GetChildsRect;
    //Do not set Visible, avoid trigger OnChangeVisibility
    ShowScroll := False;
  
    if (saVertical in fScrollAxisSet) then
    begin
      if KMRectHeight(ChildsRect) + fPadding.Top + fPadding.Bottom > KMRectHeight(fClipRect) then
      begin
        fScrollBarV.MaxValue := KMRectHeight(ChildsRect) - KMRectHeight(fClipRect) + fPadding.Top + fPadding.Bottom;
        NewPos := fClipRect.Top - Top;
  
        if NewPos > fScrollBarV.MaxValue then
          fTop := Top + NewPos - fScrollBarV.MaxValue; //Slightly move panel to the top, when resize near maxvalue position
        ShowScroll := True;
      end else begin
        fScrollBarV.Position := 0;
        if Top <> fClipRect.Top then
          fTop := fClipRect.Top; //Set directrly to avoid SetTop call
      end;
    end;
  
    fScrollBarV.Height := Height;
    if ShowScroll <> fScrollBarV.Visible then
      fScrollBarV.Visible := ShowScroll;
  end;
  
  
  procedure TKMScrollPanel.UpdateScrolls(Sender: TObject);
  begin
    UpdateScrollV(Sender);
    UpdateScrollH(Sender);
  end;
  
  
  
negative.code:   fScrollBarV.OnChange := ScrollChanged;
    fScrollBarV.WheelStep := 10;
  
  //  if aEnlargeParents then
  //  begin
  //    if saHorizontal in aScrollAxisSet then
  //      Enlarge(fScrollBarH);
  //
  //    if saVertical in aScrollAxisSet then
  //      Enlarge(fScrollBarV);
  //  end;
  
    fClipRect := KMRect(Left, Top, Right, Bottom);
  end;
  