Note that there are some explanatory texts on larger screens.

plurals
  1. POTextBox with vertical scrollbar on the left side
    primarykey
    data
    text
    <p>I'm developing a Windows Forms application in C#, which has a multiline TextBox control on a form.</p> <p>Due to specific (irrelevant) reasons, this TextBox needs a vertical scrollbar on the <em>left</em> side of the TextBox control. I've off course searched for a solution, but I couldn't find any... so my questions are:</p> <p>1) Is there a way to make the automatic vertical scrollbar of a TextBox control (or a usercontrol derived from TextBox or TextBoxBase) appear on the left instead of the right? This is the preferred method, since all scolling is then still handled by the control. Since chancing the RightToLeft property for such a TextBox actually moves the scrollbar to the left, I feel there must be a hack to be exploited here.</p> <p>or</p> <p>2) Is there a message that I can intercept with my IMessageFilter implementation when the TextBox is scrolled, even though it doesn't have scrollbars? I.e. a user can scroll using the arrow keys and the textbox will move lines up and down, but I can't find any messages fired when that occurs.</p> <p>Maybe another idea of how to accomplish this?</p> <p>Edit to add: The text needs to be aligned to the <em>right</em> horizontally! Otherwise I would have solved it already.</p> <p><strong>New edit as of 11/03/2014</strong>: Okay, after BenVlodgi's comment I started having doubts about my own sanity. So I created a test project and now I remember why setting <code>RightToLeft</code> to <code>Yes</code> was not working.</p> <p>The image below shows a regular TextBox on the left with that setting. The scrollbar is on the left and the text on the right, but the text is not shown properly. The period at the end of the sentence is moved in front of the sentence.</p> <p>The second TextBox control is the one suggested in LarsTech's answer, which functions correctly and does not move any punctuation.</p> <p><img src="https://i.stack.imgur.com/J9O62.png" alt="Difference between the two TextBox controls"></p> <p>Therefore, I accept and reward the bounty to LarsTech's answer.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload