After obtaining the cursor in the DataGrid, press the Tab button to move its focus to other controls.

xiaoxiao2021-03-06  25

Public class myTabdataGrid

Inherits System.Windows.Forms.DataGrid

'/

#Region "Windows Form Designer Generated Code"

Public Sub New ()

Mybase.new ()

'This call is required for the Windows Form Designer.

InitializeComponent ()

'Add any initialization after INITIALIZECOMPONENT ()

End Sub

'UserControl overrides Dispose to clean the component list.

Protected Overloads Overrides Sub Dispose (Byval Disposing as Boolean)

IF Disposing then

IF not (Components Is Nothing) THEN

Components.dispose ()

END IF

END IF

Mybase.dispose (Disposing)

End Sub

'Windows Form Designer

Private Components as System.comPonentModel.icontainer

'Note: The following process is necessary for the Windows Form Designer.

'You can modify this process using the Windows Form Designer.

'Don't modify it using the code editor.

private subinitializecomponent ()

Components = new system.componentmodel.container ()

End Sub

#End region

'//

Private next_Object as button

_

Public property get_button () as button 'This can be set to a CONTROL type attribute, not just a button, only a simple demonstration here.

Get

Return next_Object

END GET

Set (Byval Value As Button)

Next_Object = Value

End set

End Property

Protected Overrides Function ProcessCmdkey (byref msg as system.windows.forms.Meys, Byval KeyData as system.windows.forms.keys) as boolean

DIM WM_KEYDOWN AS INTEGER = 256

DIM WM_SYSKEYDOWN AS INTEGER = 260

IF ((msg.msg = wm_keydown) or (msg.msg = WM_SYSKEYDOWN)) THEN

Select Case Keydata

Case keys.tab

If Next_Object Is Nothing The Exit Function

Next_Object.focus ()

Return True

'Case Keys.Down

'Msgbox ("Ascending the arrow key")

'Return True

'Case Keys.up

'Msgbox ("Turned up arrow keys")

'Return True

'Case Keys.enter

'SendKeys.send ("{tab}")

'Return True'case Keys.Control Keys.m

'Msgbox (" m combination key is intercepted"))

'Return True

'Case Keys.alt Keys.z

'Msgbox (" z combination key is intercepted")))

'Return True

End SELECT

END IF

END FUNCTION

END CLASS

转载请注明原文地址:https://www.9cbs.com/read-44400.html

New Post(0)