Results 1 to 6 of 6

Thread: rich text box

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2000
    Location
    Nashville, TN
    Posts
    54
    What is the syntax to align something in the center

    richtextbox1.SelAlignment = ?

    thanks


  2. #2
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    461
    SelAlignment only works if you already have text selected. If you dont have anything selected then it cannot "Sel(ect)Alignment"

    You need to use the SelStart and SelLength to set what is currently selected (or alternatively use the mouse to select the portion and then in your procedure you can do the following )

    Code:
    If richtextbox1.SelLength > 0 Then
      richtextbox1.SelAlignment = 0
    End If
    0 - Left
    1 - Right
    2 - Center

  3. #3
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    A Couple of choices

    Hi steel,

    You can use
    Code:
    richtextbox1.SelAlignment = 2
    
    or
    
    richtextbox1.SelAlignment = rtfCenter
    Sorry Gen-X, but I have to disagree with you based on this information from MSDN:
    The SelAlignment property determines paragraph alignment for all paragraphs that have text in the current selection or for the paragraph containing the insertion point if no text is selected.
    All the best.

    [Edited by OneSource on 03-26-2000 at 08:53 PM]

  4. #4
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    461
    Hey I just copied the example from MSDN...

    They put in the test for SelLength not me :smile:

  5. #5
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    Gen-X


  6. #6

    Thread Starter
    Member
    Join Date
    Feb 2000
    Location
    Nashville, TN
    Posts
    54
    Thanks guys

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