Now I still haven't found the perfect solution. Ideally I would like the innermost control to have precedence. So first TextEntry gets the Ctrl-V, then if we are not on the TextEntry control, the Form's mnuPaste has precedence. However, I can't seem to get this going.
The best I can do is direct the Ctrl events to the ActiveControl like this:
In the Form declare this function:
Private Declare Auto Function SendMessage Lib "user32" ( ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr ) As IntPtr
Then overide ProcessCmdKey in the Form:
Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
SendMessage(Me.ActiveControl.Handle, msg.Msg, msg.WParam, msg.LParam)
End Function
You can also use this type of call to send Ctrl from the MDI Parent to the Child form. In that case you would replace Activecontrol with ActiveMdiChild.
No comments:
Post a Comment