我用delphi做一个在触摸屏上用的浏览器,怎么用按钮来控制webbrowser控件里的滚动条,使我能通过点击按钮的方式来使其滚动.急!!!!!!!!!

解决方案 »

  1.   

    uses MSHTML;var
      htmldoc: IHTMLDocument2;
      wb: tembeddedwb;
    begin
      scrspeed:=10;
      WB := GetVisibleWebBrowser;
      if wb <> nil then
      begin
        htmldoc := wb.Document as IHTMLDocument2;
        MaxScrollHeight := htmldoc.body.getAttribute('ScrollHeight', 0);
        ScrollHeight := ScrollHeight + scrspeed;
        if ScrollHeight < MaxScrollHeight then
          htmldoc.Get_ParentWindow.ScrollBy(0, scrspeed)
      end ;
    end;
      

  2.   

    简化一下:
    uses MSHTML;var
      htmldoc: IHTMLDocument2;
    begin
      htmldoc := webbrowser1.Document as IHTMLDocument2;
      htmldoc.Get_ParentWindow.ScrollBy(0, 10);
    end;