title: Richtextbox convert a line number to scroll bar position
body: <p>I'm able now to synchronize my two <code>RichTextBox</code> using this potion of code:</p>
  
  <pre><code>private const int SB_HORZ = 0x0;
  private const int SB_VERT = 0x1;
  private const int WM_HSCROLL = 0x114;
  private const int WM_VSCROLL = 0x115;
  private const int SB_THUMBPOSITION = 4;
  [DllImport("user32.dll", CharSet = CharSet.Auto)]
  private static extern int GetScrollPos(int hWnd, int nBar);
  [DllImport("user32.dll")]
  private static extern int SetScrollPos(IntPtr hWnd, int nBar, int nPos, bool bRedraw);
  [DllImport("user32.dll")]
  private static extern bool PostMessageA(IntPtr hWnd, int nBar, int wParam, int lParam);
  internal int HScrollPos
  {
      private get { return GetScrollPos((int)this.Handle, SB_HORZ); }
      set
      {
          SetScrollPos((IntPtr)this.Handle, SB_HORZ, value, true);
          PostMessageA((IntPtr)this.Handle, WM_HSCROLL, SB_THUMBPOSITION + 0x10000 * value, 0);
      }
  }
  internal int VScrollPos
  {
      get { return GetScrollPos((int)this.Handle, SB_VERT); }
      set
      {
          SetScrollPos((IntPtr)this.Handle, SB_VERT, value, true);
          PostMessageA((IntPtr)this.Handle, WM_VSCROLL, SB_THUMBPOSITION + 0x10000 * value, 0);
      }
  }
  </code></pre>
  
  <p>I can synchronize the <code>RichTextBoxes</code> while key down ,up and <code>Vscroll</code> event.
  Indeed this is not my goal, I want to synchronize my <code>RichTextBoxes</code> basing on the content,
  <strong>What do I need:</strong> </p>
  
  <ul>
  <li>Get the current line form non-selected <code>RichTextBox</code>.</li>
  <li>Set Scroll bar position using line number in the other <code>RichTextBox</code> (without losing the focus from the current one).</li>
  <li>Get line number using scroll bar position.</li>
  </ul>
  
  <hr>
  
  <p><em>Note:</em> you are welcome to ask if you need any more details.<br/>
  Thanks in advance.</p>