anchor.diff:      Position := Math.Min(Position, Max - PaintPanel.Width);
   end;
   
  -procedure THtmlViewer.Scroll(Sender: TObject; ScrollCode: TScrollCode;
  -  var ScrollPos: Integer);
  +procedure THtmlViewer.ScrollHorz(Sender: TObject; ScrollCode: TScrollCode; var ScrollPos: Integer);
   {only the horizontal scrollbar comes here}
   begin
     ScrollPos := Min(ScrollPos, HScrollBar.Max - PaintPanel.Width);
  
positive.code:     THtmlViewer(FViewer).HTMLMouseDblClk(Message);
  end;
  
  { T32ScrollBar }
  
  procedure T32ScrollBar.SetParams(APosition, APage, AMin, AMax: Integer);
  var
    ScrollInfo: TScrollInfo;
  begin
    if (APosition <> FPosition) or (APage <> FPage) or (AMin <> FMin)
      or (AMax <> FMax) then
      with ScrollInfo do
      begin
        cbSize := SizeOf(ScrollInfo);
        fMask := SIF_ALL;
        if htShowVScroll in (Owner as THtmlViewer).FOptions then
          fMask := fMask or SIF_DISABLENOSCROLL;
        nPos := APosition;
        nPage := APage;
        nMin := AMin;
        nMax := AMax;
        SetScrollInfo(Handle, SB_CTL, ScrollInfo, True);
        FPosition := APosition;
        FPage := APage;
        FMin := AMin;
        FMax := AMax;
      end;
  end;
  
  procedure T32ScrollBar.SetPosition(Value: Integer);
  var
    SavePos: Integer;
  begin
    SavePos := FPosition;
    SetParams(Value, FPage, FMin, FMax);
    if FPosition <> SavePos then
      Change;
  end;
  
  procedure T32ScrollBar.SetMin(Value: Integer);
  begin
    SetParams(FPosition, FPage, Value, FMax);
  end;
  
  procedure T32ScrollBar.SetMax(Value: Integer);
  begin
    SetParams(FPosition, FPage, FMin, Value);
  end;
  
  {$ifdef LCL}
  procedure T32ScrollBar.CNVScroll(var Message: TLMVScroll);
  {$else}
  procedure T32ScrollBar.CNVScroll(var Message: TWMVScroll);
  {$endif}
  var
    SPos: Integer;
    ScrollInfo: TScrollInfo;
    OrigPos: Integer;
    TheChange: Integer;
  begin
    with THtmlViewer(Parent) do
    begin
      ScrollInfo.cbSize := SizeOf(ScrollInfo);
      ScrollInfo.fMask := SIF_ALL;
      GetScrollInfo(Self.Handle, SB_CTL, ScrollInfo);
      if TScrollCode(Message.ScrollCode) = scTrack then
      begin
        OrigPos := ScrollInfo.nPos;
        SPos := ScrollInfo.nTrackPos;
      end
      else
      begin
        SPos := ScrollInfo.nPos;
        OrigPos := SPos;
        case TScrollCode(Message.ScrollCode) of
          scLineUp:
            Dec(SPos, SmallChange);
          scLineDown:
            Inc(SPos, SmallChange);
          scPageUp:
            Dec(SPos, LargeChange);
          scPageDown:
            Inc(SPos, LargeChange);
          scTop:
            SPos := 0;
          scBottom:
            SPos := (FMaxVertical - PaintPanel.Height);
        end;
      end;
      SPos := Math.Max(0, Math.Min(SPos, (FMaxVertical - PaintPanel.Height)));
  
      Self.SetPosition(SPos);
  
      FSectionList.SetYOffset(SPos);
      if vsBGFixed in FViewerState then
        PaintPanel.Invalidate
      else
      begin {scroll background}
        TheChange := OrigPos - SPos;
        ScrollWindow(PaintPanel.Handle, 0, TheChange, nil, nil);
        PaintPanel.Update;
      end;
    end;
  end;
  
  { PositionObj }
  
  
negative.code:     procedure Paint; override;
    end;
  
  //  T32ScrollBar = class(TScrollBar) {a 32 bit scrollbar}
  //  private
  //    FPosition: Integer;
  //    FMin, FMax, FPage: Integer;
  //    procedure SetPosition(Value: Integer);
  //    procedure SetMin(Value: Integer);
  //    procedure SetMax(Value: Integer);
  //{$ifdef LCL}
  //    procedure CNVScroll(var Message: TLMVScroll); message LM_VSCROLL;
  //{$else}
  //    procedure CNVScroll(var Message: TWMVScroll); message CN_VSCROLL;
  //{$endif}
  //  public
  //    property Position: Integer read FPosition write SetPosition;
  //    property Min: Integer read FMin write SetMin;
  //    property Max: Integer read FMax write SetMax;
  //    procedure SetParams(APosition, APage, AMin, AMax: Integer);
  //  end;
  
    THtmlFileType = (HTMLType, TextType, ImgType, OtherType);
  
  