当焦点位于按钮上时,如何禁用页面 Down/Up?
How can I disable the Page Down/Up, when the Focus in on a Button?
我有一个程序可以更改数据库中的值。我的表单中有一个 TrueDBGrid,页面 Down/Up 工作正常。如果我用 TAB 单击按钮,此页面 Down/Up 仍然有效。当焦点在按钮上时,如何防止出现这种情况?
我找到了解决办法。那将是:
Private Sub frmZeitcodeListe_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown
Try
If e.KeyCode = Keys.PageUp Then
If cmdBearbeiten.Focused = True Or cmdLoeschen.Focused = True Or cmdNeu.Focused = True Or cmdSchliessen.Focused = True Then
e.Handled = False
Else
bsTblZeitcode.MovePrevious()
e.Handled = True
End If
ElseIf e.KeyCode = Keys.PageDown Then
If cmdBearbeiten.Focused = True Or cmdLoeschen.Focused = True Or cmdNeu.Focused = True Or cmdSchliessen.Focused = True Then
e.Handled = False
Else
bsTblZeitcode.MoveNext()
e.Handled = True
End If
End If
Catch ex As Exception
End Try
End Sub
我有一个程序可以更改数据库中的值。我的表单中有一个 TrueDBGrid,页面 Down/Up 工作正常。如果我用 TAB 单击按钮,此页面 Down/Up 仍然有效。当焦点在按钮上时,如何防止出现这种情况?
我找到了解决办法。那将是:
Private Sub frmZeitcodeListe_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown
Try
If e.KeyCode = Keys.PageUp Then
If cmdBearbeiten.Focused = True Or cmdLoeschen.Focused = True Or cmdNeu.Focused = True Or cmdSchliessen.Focused = True Then
e.Handled = False
Else
bsTblZeitcode.MovePrevious()
e.Handled = True
End If
ElseIf e.KeyCode = Keys.PageDown Then
If cmdBearbeiten.Focused = True Or cmdLoeschen.Focused = True Or cmdNeu.Focused = True Or cmdSchliessen.Focused = True Then
e.Handled = False
Else
bsTblZeitcode.MoveNext()
e.Handled = True
End If
End If
Catch ex As Exception
End Try
End Sub