0

I have two RichTextBoxes on my C# main form. Both RTBoxes are with SrollBars=None. They are used to visualize contents of two different files of different size. How can I use separate VScollbar to navigate through text of those RTBoxes simultaneously?

Browsing forums got a hint to use:

SendMessage(rtBox1.Handle, (uint)WM_VSCROLL, (UIntPtr)SB_LINEDOWN, (IntPtr)(0)).

But I'm completely lost in synchronizing of scrolling for the two RTBoxes.

The idea of scrollbar is to show contents of the files synchronously like when VScrolbar.Value=50 both RTBoxes present text at the middle of the files (sorry for my English). Any piece of real code is highly appreciated!

Luuk
  • 12,245
  • 5
  • 22
  • 33
ASvel
  • 1
  • Does this answer your question? [C#: Synchronize Scroll Position of two RichTextBoxes?](https://stackoverflow.com/questions/1827323/c-synchronize-scroll-position-of-two-richtextboxes) – Luuk Jul 11 '21 at 09:28
  • Luuk thanks a lot, BUT it started that both RTBoxes always have THE SAME number of lines of text. In my case they have DIFFERENT number of lines. Anyway there i found a good reference to other branch worth testing (https://stackoverflow.com/questions/3322741/synchronizing-multiline-textbox-positions-in-c-sharp/3779949#3779949) – ASvel Jul 11 '21 at 12:05

0 Answers0