Post by bobowk on Aug 5, 2016 15:08:40 GMT 10
RichTextBox Ruler With Left Margins
I have not found this on the internet and I am quite surprised because this subject seems to appear a lot on the internet. An example of what I mean is that in Microsoft word, we have the margins which set the text a little bit further from the left or right of the page. I have a source code file, links above. The example comes with complete source code and a preview is the source code which is pictured below. This has been a question which has been haunting me for over 8 months until I finally figured it out! This can be used in VB.net and C#. The code is down below + the link for the ruler control dll. VB.net:In your Form_Load event, add this code: RichTextBox1.SelectionIndent=56 'You can change this value RichTextBox1.SelectionRightIndex=56 'You can also change this value
You can also do this with a ruler control by doing this: Private Sub RulerControl1_Click(sender As Object, e As EventArgs) Handles RulerControl1.Click
RichTextBox1.SelectionIndent = RulerControl1.MouseLocation
PictureBox1.Location = New Point(RulerControl1.MouseLocation)
End Sub
ALTHOUGH! I do not know how to do it for the right indent So just leave it... Unless you find a way... C#:
In your Form_Load event, add this code: RichTextBox1.SelectionIndent= 56; RichTextBox1.SelectionRightIndent= 56; You can also do this with a ruler control by doing this: private void RulerControl1_Click(object sender, EventArgs e)
{
RichTextBox1.SelectionIndent = RulerControl1.MouseLocation;
PictureBox1.Location = new Point(RulerControl1.MouseLocation);
}
ALTHOUGH! I do not know how to do it for the right indent So just leave it... Unless you find a way...
All Source and Examples of the code have been made by me. The RulerControl is not affliated with FlamingSun in any shape or form. Author: Brandon Woolcock, Owner of FlamingSun
|
|