CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: RichTextBox

  1. #1
    Join Date
    Jun 1999
    Posts
    16

    RichTextBox

    Hello!

    In my VB5 programm the RichTextBox OCX Control always wraps the text and uses not horizontal scrollbar of the control.
    I want to use horizontal scrollbar and no wordwraps! Is it possible?
    Version of my RichTextBox OCX Control is 5.01.4319.

    Thanks berore hand!

    Pasi Salminen
    [email protected]


  2. #2
    Join Date
    Jul 1999
    Posts
    145

    Re: RichTextBox

    Just change the ScrollBars property to whatever you like and that will take care of the first problem. For the second problem, if you set the MultiLine property to false, you won't have to worry about wordwrapping but then you won't be able to enter to the next line either. Try looking through the help files, you'll find more info there.


  3. #3
    Join Date
    Jun 1999
    Posts
    16

    Re: RichTextBox

    Hi!

    I have set the Multiline property to True and the ScrollBars property to rftBoth. But still the horizontal scrollbar is never in use. Why? The OCX Control always wraps long rows to several rows.

    Pasi Salminen
    [email protected]



  4. #4
    Join Date
    Jul 1999
    Posts
    145

    Re: RichTextBox

    You need to set the multiline property to FALSE not true. If you want a horizontal scrollbar, set the scroll bar property accordingly. The scrollbar will only appear if the length of the text entered exceeds the width of the control.


  5. #5
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    Re: RichTextBox

    Hi,

    Your observation that 'you will only get Horizontal scroll bar only if the text is outside the window' is very correct. But the text never goes outside the window, then how to?!

    It is because, Richedit text box ( or even Multiline text box) has a "Margined" area and by default the left and right Margins concide with the window area.

    So you will have to explicitelyset the Marigns outside the Window to get the scrollbars. To do this you have to send a message EM_SETMARGINS. and EM_GETMARGINS for retrieving the margin area.

    Ofcouse you will also have to set the ScrollBar property also.

    Look into MSDN for finding out what are the wParam and lParam for this message. Obviously one of them would be the Margin positions.:-)

    I will give a try too.. get back to me if you want code.

    Ravi Kiran


  6. #6
    Join Date
    May 1999
    Posts
    3,332

    Re: RichTextBox

    Wow, that's cool. I have been banging my head against this and couldn't get a solution.

    You are right. You need to set the margins.
    But, you don't have to use the API. The RichTextbox control has a RightMargin property that you can set.



  7. #7
    Join Date
    Jun 1999
    Posts
    16

    Re: RichTextBox

    That resolved my problem!

    Thank you very much!

    Pasi Salminen
    [email protected]



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

Featured