Results 1 to 4 of 4

Thread: RichTextBox AlignMent

  1. #1

    Thread Starter
    Lively Member lavarock09's Avatar
    Join Date
    Jun 2005
    Posts
    124

    RichTextBox AlignMent

    How Do I Get The Text To Be Aligned When I Press A Button

    Thanx For All Your Help

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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

  3. #3
    Hyperactive Member
    Join Date
    Feb 2005
    Posts
    346

    Re: RichTextBox AlignMent

    rtbMain.SelAlignment = rtfCenter 'aligns to the center
    rtbMain.SelAlignment = rtfLeft 'aligns to the left
    rtbMain.SelAlignment = rtfRight 'aligns to the right

    Microsoft gives you Windows, Linux gives you the whole house!


    I am who I am because of who we all are.


    We have just gotten a wake up call from the Nintendo generation.

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    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
  •  



Click Here to Expand Forum to Full Width