473,386 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Tab stop position

Hi all! Can somebody tell me how to customize the tab stop position in
a rich text box? Just like we do in MS Word by clicking the ruler! I've
been searching the web but I can't find the answer! Please help me,
thanks in advance!

Dec 25 '05 #1
4 2799

If you set a few tab stops in WordPad, the result might look like
this:

---snip---
{\rtf1\ansi\ansicpg1252\deff0\deflang1030{\fonttbl {\f0\fswiss\fcharset0
Arial;}}
{\*\generator Msftedit
5.41.15.1507;}\viewkind4\uc1\pard\tx1704\tx2840\tx 4544\f0\fs20 abc\tab
def\tab ghi\tab jkl\par
}
---snip---

The tab definitions in the example above are "tx1704\tx2840\tx4544".

Look up the RTF 1.5 specification for more details.

For some inspiration, have a look at this sample program:
http://www.codeproject.com/richedit/...cheditctrl.asp

Download the source and look at the "Do..." methods in the
file "RulerRichEditCtrl.cpp", esp. "DoIndent" where you will
find an interesting constant named "PFM_TABSTOPS.

Googling for this brings us to http://tinyurl.com/bhzon

Fill out the PARAFORMAT2 structure correctly and send it to
the RichText control and you should be in business.

Perhaps there is already a .Net implementation/wrapper for this?

Otherwise you will have to take one of the many RichEdit
wrapper samples out there and extend it with the required
functionality.

Would be nice if Microsoft provided a decent wrapper out of the box.
The current wrapper is next to useless.

Hope any of this helps point you in the right direction, though
I am sure it is not what you were hoping for.

Joergen Bech

On 24 Dec 2005 19:52:52 -0800, "Stanley" <xs******@gmail.com> wrote:
Hi all! Can somebody tell me how to customize the tab stop position in
a rich text box? Just like we do in MS Word by clicking the ruler! I've
been searching the web but I can't find the answer! Please help me,
thanks in advance!


Dec 25 '05 #2
"Stanley" <xs******@gmail.com> schrieb:
Can somebody tell me how to customize the tab stop position in
a rich text box? Just like we do in MS Word by clicking the ruler!


\\\
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/>
Dec 25 '05 #3
On Sun, 25 Dec 2005 19:44:39 +0100, "Herfried K. Wagner [MVP]"
<hi***************@gmx.at> wrote:
"Stanley" <xs******@gmail.com> schrieb:
Can somebody tell me how to customize the tab stop position in
a rich text box? Just like we do in MS Word by clicking the ruler!


\\\
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
///


Ah! So it already has been wrapped. Sorry about my original
answer. It was not incorrect as to what needed to be sent to
the control (.SelectionTabs does the same thing), but ...

Did some work with the RichText control half a year ago.
Had some problems setting and getting formatting information
in the cases where the current selection would span multiple
formattings and I needed to change just one aspect of the
formatting across the whole selection. I believe this is still a
problem in VS2005. Guess I just still had a sour taste in my
mouth from that experience.

I need to learn to look before I leap.

/JB

Dec 25 '05 #4
Thanks all for spending your precious to help me! Thank JB, thank
Herfried!

Dec 26 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Dave | last post by:
I am working with a proprietary database that records the date, time, location, and speed of a vehicle. It is pulling this information from GPS unit tied to a vehicle. The table is populated with...
4
by: Web Team | last post by:
Hi All, I'm trying to stop text from wrapping in a span, so that my users can enter content with out the box stretching across the screen when they reach the edge of it, and with out horizontal...
7
by: supster | last post by:
I'de like to ask users if they are able to save their work before they close using the normal "Save? Yes, No, Cancel" type of message box. I've got this so far: private void...
2
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. Is there a way to start, pause and resume a recurrsive search exactly where you left off, say in the registry programmatically? -- Michael Bragg,...
3
by: G | last post by:
Hello, I would like look at a user-entered string, and copy all characters starting from the left until a number is found. As soon as a number is detected, the copy should stop and the...
8
praclarush
by: praclarush | last post by:
Ok, I'm new to JavaScript and I'm taking a class for it the assignment in it I'm supposed to create edit a pre-made page to display a marquee that automatically scrolls for the user, as well as give...
1
by: Shaba99 | last post by:
Hey everyone, New to this forum, but i search for answers here often. I have a c# windows application which embeds windows media player on the form. The application (biz rule) requires that the...
5
by: Brian Cryer | last post by:
Currently I am using XmlReader (but I am open to other options) to parse an XML file, and I would like to be able to stop/break the current parse (simple enough) and then resume it later (say after...
1
by: sunilkds | last post by:
In my project it has lot of code to execute,so it will take some time to get result.So i want stop in middle of execution and to come normal position. Is there any keyword in vb6 to stop execution...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.