Rich Text Box Margin

a_jam_sandwich

Junior Contributor
Joined
Dec 10, 2002
Messages
367
Location
Uk
Im using a Rich Text Box for document creation but I need to set the Margin Rules (Column Position) so pressing TAB lines up according to where I specify

Whats the property any one know?

Cheers

Andy
 
you mean the selindent then? as in how far from the left of the richtextbox the text starts? if so this is an example i put together to show how the indent moves the text over...
Visual Basic:
    Private Sub Button1_Click(ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles Button1.Click 
        RichTextBox1.SelectionStart = Len(RichTextBox1.Text)
        RichTextBox1.SelectionIndent = 0
        RichTextBox1.SelectedText = "TEXT ON LEFT" & vbCrLf

        'first set some text from the very edge of the rtf box

        RichTextBox1.SelectionStart = Len(RichTextBox1.Text)
        RichTextBox1.SelectionIndent = 10
        RichTextBox1.SelectedText = "TEXT MOVED OUTWARDS" & vbCrLf

        'then set some with the indent set to "10"
End Sub

when you click the command button, you'll first get the text at the very left of the box, then on the next row you'll get the text with a margin to the left of it.
hope this helps you :)
 
Last edited:
no problem:) , btw as you probably know the numbers for size ( ie: the 10 in the indent area ) are way different to vb6. in vb6 i use 200 as a rough indent for seltext, i tried 200 in .net and there was text in the last 5 millimeters of the richtextbox, but most of the box was blank due to the size of the indent.
i'm not to sure what the differences are with the sizes and if it's possible to calculate what a vb6 size is in .net but size of indent being 10 in .net, is pretty similar to size 200 in vb6.
 
I would guess that in VB6 that measurement was in Twips. Thankfully, Twips have gone the way of the dodo in .net (although if you look hard enough you can find references in the vb.net runtime).
 
Back
Top