I\'m developing a Windows Forms application in C#, which has a multiline TextBox control on a form.
Due to specific (irrelevant) reasons, this TextBox needs a vertic
I took some of the example code from Rachel Gallen's link and made this version of the TextBox:
public class TextBoxWithScrollLeft : TextBox {
private const int GWL_EXSTYLE = -20;
private const int WS_EX_LEFTSCROLLBAR = 16384;
[DllImport("user32", CharSet = CharSet.Auto)]
public extern static int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32")]
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
protected override void OnHandleCreated(EventArgs e) {
base.OnHandleCreated(e);
int style = GetWindowLong(Handle, GWL_EXSTYLE);
style = style | WS_EX_LEFTSCROLLBAR;
SetWindowLong(Handle, GWL_EXSTYLE, style);
}
}
I've never done it before, but the results seem to have worked:
By setting the RightToLeft property true. But it said the content would also be from right to left, so I don't know if that would solve your problem...But that's a way to set the scrollbar on the left hand side.
http://bytes.com/topic/c-sharp/answers/255138-scrollbar-position