Results 1 to 3 of 3

Thread: RTF again

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523

    Post

    How can I do it so when there is too many characters in one line it will automatically send cursor to another line? In RichTextBox

    ------------------
    Visual Basic Programmer (at least I want to be one)
    -----------------
    PolComSoft
    You will hear a lot about it.




    [This message has been edited by QWERTY (edited 11-05-1999).]

  2. #2
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892

    Post

    Try using the EM_LINELENGTH message, like this:
    Code:
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    
    
    Private Const EM_LINELENGTH = &HC1
    
    
    Private Const MaxLineLength = 20 ' Change to... Whatever...
    
    
    Private Sub RichTextBox1_Change()
        If SendMessage(RichTextBox1.hWnd, EM_LINELENGTH, RichTextBox1.SelStart, ByVal 0&) >= MaxLineLength Then RichTextBox1.SelText = vbNewLine
    End Sub
    ------------------
    Yonatan
    Teenage Programmer
    E-Mail: [email protected]
    ICQ: 19552879



  3. #3
    New Member
    Join Date
    Oct 1999
    Posts
    3

    Post

    Set the RichTextBox's RightMargin property to the max line length that you want this will start the text wrap once the line is the max length. If you wish to stop the text wrap altogether set it to around 99999.

    [This message has been edited by Dingo (edited 11-06-1999).]

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