Results 1 to 28 of 28

Thread: [RESOLVED] [VB6(windows 7) - richtextbox] - how show the scrollbars?

Hybrid View

  1. #1

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: [RESOLVED] [VB6(windows 7) - richtextbox] - how show the scrollbars?

    Quote Originally Posted by techgnome View Post
    Is there a wordwrap property? If so, make sure it is set to false... it's been a long time since I've used the RTB in a VB6 environment, but I want to say that there is a property and it is set to True by default... see if that changes anything.

    -tg
    the problem is that: there isn't. try see yourself
    even the textbox don't have it, but when i put the scrollbars, works normaly
    but i'm thinking, if RTB have the hwnd property, maybe there is an API function(or way) for that. but until now i found only with rightmargin property
    VB6 2D Sprite control

    To live is difficult, but we do it.

  2. #2

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: [RESOLVED] [VB6(windows 7) - richtextbox] - how show the scrollbars?

    finally i found another way
    Code:
    Option Explicit
    
    Private Const WM_USER = &H400
    
    Private Const EM_SETTARGETDEVICE = (WM_USER + 72)
    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 Sub Form_Load()
        SendMessage RichTextBox1.hwnd, EM_SETTARGETDEVICE, 0, ByVal -1&
    End Sub
    i have tested and works fine(don't forget show the scrollbars).
    so what is the diference between righmargin and these? seems these code desactivate the wordwrap property and the horizontal scrollbar is showed only after write some text.
    but i have update the code:
    module:
    Code:
    Private Const WM_USER = &H400
    
    Private Const EM_SETTARGETDEVICE = (WM_USER + 72)
    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
    
    Public Sub WordWrap(ControlHandle As Long, ActivateWordWrap As Boolean)
        If ActivateWordWrap = False Then
            SendMessage ControlHandle, EM_SETTARGETDEVICE, 0, ByVal -1&
        Else
            SendMessage ControlHandle, EM_SETTARGETDEVICE, 0, ByVal 0&
        End If
    End Sub
    how use it:
    Code:
    Private Sub Command1_Click()
        WordWrap RichTextBox1.hwnd, False
    End Sub
    these code works fine with RichTextBox control but these code, not tested with another controls, can be used with another controls
    thanks for all
    VB6 2D Sprite control

    To live is difficult, but we do it.

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