title: WPF Web Browser Control with Custom Scrollbar
body: <p>I'm trying to make a custom scroll bar for <code>Web browser Control</code>.</p>
  
  <p>I used a <code>Scroll Bar Control</code> for this,so i attached <code>Scroll Bar Control</code> to <code>Web browser Control</code>
  use following code:</p>
  
  <pre><code>        Doc = (mshtml.HTMLDocument)browser.Document;
          Doc.parentWindow.document.body.style.overflow = "hidden";
          mshtml.IHTMLElement2 ScrolablePlace= (mshtml.IHTMLElement2)Doc.getElementById("ScrolablePlace");
          ScrollBar.ViewportSize = browser.ActualHeight;
          ScrollBar.Maximum = ScrolablePlace.scrollHeight;
  </code></pre>
  
  <p>and while scroling scrolbar:</p>
  
  <pre><code> private void ScrollBar_Scroll(object sender, ScrollEventArgs e)
          {
              if (Doc != null)
              {
                  Doc.parentWindow.scroll(0, (int)e.NewValue);
              }
          }
  </code></pre>
  
  <p>this is work,but <code>ScrollBar.Maximum</code> value is always larger than scroll bar place.dose <code>ScrollBar.ViewportSize</code>  and <code>ScrollBar.Maximum</code> 
  set correctly?</p>
  
  <p>I Hope i could explain my problem correctly with this image:</p>
  
  <p><img src="https://i.stack.imgur.com/GQlOD.png" alt="enter image description here"></p>