RichTextBox1.Locked=True
does not work
Thanks,
Dan
Daniel -
I have racked my brains about this one. Unfortunately, there is no simple
solution. You would have to use subclassing to intercept the WM_MOUSEMOVE
message: I would guess it is the one which starts the dragging process of
resize. You can't use timers and GetCapture() since timers are blocked by
dragging actions.
Another approach would be to trap the Change event, check whether the text
has changed, and make the assumption that if the text hasn't changed, then a
picture has been moved or resized.
--
Mark Alexander Bertenshaw
LEAX Controls
Battersea
UK
Sorry - I forgot to add that you would then Undo the changes with:
----------------
Private Declare Function SendMessage Lib "User32.dll" Alias "SendMessageA"
(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam
As Long) As Long
Private Const EM_UNDO As Long = &HC7
Private m_sOldText As String
Private Sub rtb_Change()
If m_sOldText = rtb.Text Then
SendMessage rtb.hWnd, EM_UNDO, ByVal 0&, ByVal 0&
Else
m_sOldText = rtb.Text
End If
End Sub
----------------
Obviously, you need to set m_sOldText when you load the document.
It looks like if you know where the picture was placed at, then you can
block its being resized. For example, let's say you stored the SelStart
location of a picture you place in the RichTextBox control in a variable
named PicturePosition, or you store the current SelStart location in
PicturePosition after checking that the ClipBoard.GetFormat method was
returning something other than vbCFText when the user pasted in anything
from the ClipBoard (remember that Shift+Insert and Ctrl+V perform a Paste
operation), then placing this code
With RichTextBox1
If .SelStart >= PicturePosition And .SelLength >= 1 Then
.SelLength = 0
End If
End With
in BOTH the KeyUp and MouseUp events seems to take away the ability to
resize the picture placed there .
Rick - MVP