|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Setting tab stops in RTF controlI have an rtf control on my form. The control is populated with text from an string array created as the application runs. The code to populate the rtf control is as follows For l = 0 To arrayList.GetUpperBound(0) If arrayList(l, 0) Is Nothing Then 'do nothing Else output &= arrayList(l, 0) & vbTab & vbTab _ & arrayList(l, 1) & vbTab _ & arrayList(l, 2) & vbTab _ & arrayList(l, 3) & vbCrLf End If Next RichTextBoxList.Text = output My problem is that the 4 columns do not line up neatly in this method as the strings in any element of the array may be longer (or shorter) than that in the next element of the array. In some case the first index of the array element will be longer than where the first tab would normally go in the control and the next will be shorter. So the two columns are not lined up. I need to be able to adjust, programatically, the gap between the tab stops in the rtf control. Is that possible or is there another solution Thanks and regards Michael Bond "mabond" <mab***@discussions.microsoft.com> schrieb: \\\> My problem is that the 4 columns do not line up neatly in this method as > the > strings in any element of the array may be longer (or shorter) than that > in > the next element of the array. In some case the first index of the array > element will be longer than where the first tab would normally go in the > control and the next will be shorter. So the two columns are not lined up. > I > need to be able to adjust, programatically, the gap between the tab stops > in > the rtf control. Private Sub Form1_Load( _ ByVal sender As Object, _ ByVal e As EventArgs _ ) Handles MyBase.Load Me.RichTextBox1.Text = _ "Hallo" & ControlChars.Tab & _ "Welt" & ControlChars.Tab & _ "Bla" End Sub Private Sub Button1_Click( _ ByVal sender As Object, _ ByVal e As EventArgs _ ) Handles Button1.Click Me.RichTextBox1.SelectAll() Me.RichTextBox1.SelectionTabs() = _ New Integer() {100, 200, 300} End Sub /// -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> Herfried
Much obliged. Perfect solution Thanks Michael Bond Show quoteHide quote "Herfried K. Wagner [MVP]" wrote: > "mabond" <mab***@discussions.microsoft.com> schrieb: > > My problem is that the 4 columns do not line up neatly in this method as > > the > > strings in any element of the array may be longer (or shorter) than that > > in > > the next element of the array. In some case the first index of the array > > element will be longer than where the first tab would normally go in the > > control and the next will be shorter. So the two columns are not lined up. > > I > > need to be able to adjust, programatically, the gap between the tab stops > > in > > the rtf control. > > \\\ > Private Sub Form1_Load( _ > ByVal sender As Object, _ > ByVal e As EventArgs _ > ) Handles MyBase.Load > Me.RichTextBox1.Text = _ > "Hallo" & ControlChars.Tab & _ > "Welt" & ControlChars.Tab & _ > "Bla" > End Sub > > Private Sub Button1_Click( _ > ByVal sender As Object, _ > ByVal e As EventArgs _ > ) Handles Button1.Click > Me.RichTextBox1.SelectAll() > Me.RichTextBox1.SelectionTabs() = _ > New Integer() {100, 200, 300} > End Sub > /// > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> > >
Show quote
Hide quote
"mabond" <mab***@discussions.microsoft.com> wrote in message I've dealt with that problem in the past by using a fixed-fount, such as news:4F8D5445-22E6-4B55-963F-2515F9066E85@microsoft.com... > Hi all > > I have an rtf control on my form. The control is populated with text from > an > string array created as the application runs. The code to populate the rtf > control is as follows > > For l = 0 To arrayList.GetUpperBound(0) > If arrayList(l, 0) Is Nothing Then > 'do nothing > Else > output &= arrayList(l, 0) & vbTab & vbTab _ > & arrayList(l, 1) & vbTab _ > & arrayList(l, 2) & vbTab _ > & arrayList(l, 3) & vbCrLf > End If > Next > > RichTextBoxList.Text = output > > > My problem is that the 4 columns do not line up neatly in this method as > the > strings in any element of the array may be longer (or shorter) than that > in > the next element of the array. In some case the first index of the array > element will be longer than where the first tab would normally go in the > control and the next will be shorter. So the two columns are not lined up. > I > need to be able to adjust, programatically, the gap between the tab stops > in > the rtf control. > > Is that possible or is there another solution > > Thanks and regards > > Michael Bond > "Courier". When I was dealing with it, the problem was that some fonts are designed with different widths for each character to make them more pleasing to the eye. Ross
But what about them hackers?
Resetting the value of a System.Web.UI.HtmlControls.HtmlInputFile Order of events, databinding, and UserControls Ayuda contra unos programadores de Linux y PHP que me quieren dañar un negocio Really puzzled (or maybe just totally confused) about VB.NET and ADO.NET AppStartup "Cancel" leaves splash form loaded Word automation version problem. Stepping through datagridview rows in code Custom Datagridstyle converting a string to it's enum (integer) equivalent |
|||||||||||||||||||||||