|
-
Jun 18th, 2005, 06:16 AM
#1
Thread Starter
Lively Member
RichTextBox AlignMent
How Do I Get The Text To Be Aligned When I Press A Button
Thanx For All Your Help
-
Jun 18th, 2005, 06:27 AM
#2
Re: RichTextBox AlignMent
from helpfile
SelAlignment Property Example
This example uses an array of OptionButton controls to change the paragraph alignment of selected text in a RichTextBox control, but only if text is selected. The indices of the controls in the array correspond to settings for the SelAlignment property. To try this example, put a RichTextBox control and three OptionButton controls on a form. Give all three of the OptionButton controls the same name and set their Index property to 0, 1, and 2. Paste this code into the Click event of the OptionButton control. Then run the example.
Private Sub Option1_Click(Index As Integer)
If RichTextBox1.SelLength > 0 Then
RichTextBox1.SelAlignment = Index
End If
End Sub
pete
-
Jun 19th, 2005, 04:29 PM
#3
Hyperactive Member
Re: RichTextBox AlignMent
rtbMain.SelAlignment = rtfCenter 'aligns to the center
rtbMain.SelAlignment = rtfLeft 'aligns to the left
rtbMain.SelAlignment = rtfRight 'aligns to the right
-
Jun 19th, 2005, 04:34 PM
#4
Re: RichTextBox AlignMent
Just to fill in a bit. You actually don't have to select any text, the SelAlignment property will align the paragraph the text caret is currently in. If more then one paragraph is fully or partially selected they are all aligned according to what you set the SelAlignment property to.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|