-
Hi,
In the project that I do, I have to enable the user to move the richtextbox that he created. So I put the event "text.move" on mouse move but it just moves a shape and the richtextbox still sticks on the form.
And about resizing it, in fact I would like that when the user adds some text in the richtextbox, the box be automatically resized with the right height and width to display all the words.
Thanks for your answer.
-
Well ....
Try changing the .Left and .Top properties of the RTB control.
-
Try the following. To prevent confusion between when the user wants to type or drag, the code has been placed in the DblClick() event.
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 Declare Function ReleaseCapture Lib "user32" () As Long
Const WM_SYSCOMMAND = &H112
Const WM_MOVEEX = &HF012
Private Sub RichTextBox1_DblClick()
ReleaseCapture
SendMessage RichTextBox1.hwnd, WM_SYSCOMMAND, WM_MOVEEX, 0&
End Sub