title: Calculate offset for ScrollToVerticalOffset from line number in a WPF RichTextBox
body: <p>I want to move the content of a <code>RichTextBox</code> to a specific line of the content. The <code>RichTextBox</code> provides the method <code>ScrollToVerticalOffset</code> from the embedded <code>ScrollViewer</code>. The method is documented in MSDN, but the measurement unit of the parameter named offset is not <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.scrollviewer.scrolltoverticaloffset.aspx">specified</a>. The Type is <code>double</code>.</p>
  
  <p>A <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.textboxbase.verticaloffset.aspx"><code>VerticalOffset</code></a> property of a <code>TextBox</code> is documented as in device-independent units (1/96th inch per unit).</p>
  
  <p>So I tried to calculate the offset from the font size. The font size is given in pixels. The resulting formula is</p>
  
  <pre><code>offset = fontSize * 96 / 72  *  lineNumber;
  </code></pre>
  
  <p>But this jumps way behind the desired line. For now I am using this calculation:</p>
  
  <pre><code>offset = fontSize * lineNumber;
  </code></pre>
  
  <p>Is this correct?</p>