another important tip. by some reason, the richtextbox must be updated after change the WordWrap() (that's why you moved the control
). so i change my sub:
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 Declare Function UpdateWindow Lib "user32" (ByVal hwnd As Long) 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
UpdateWindow ControlHandle
End Sub
why i did these change? because in usercontrol wasn't working
but the move code give me the Update ideia and i used it and works
now, i have totally tested, works fine in forms and usercontrols.
i accept sugestions about these sub
thanks for all