DoboWiki
Top
> 自由区/.NET Tipsの器/DaraGridViewの使用方法/実用 をテンプレートにして作成
自由区/.NET Tipsの器/DaraGridViewの使用方法/実用 をテンプレートにして作成
開始行:
*自由区/.NET Tipsの器/DaraGridViewの使用方法/実用 [#x99ec...
下記のファイル名(コントロール継承ファイルに追加)
ファイル名
DataGridVeiwEx.Designer.vb
<System.Security.Permissions.UIPermission( _
System.Security.Permissions.SecurityAction.Demand...
Window:=System.Security.Permissions.UIPermissionW...
Protected Overrides Function ProcessDialogKey( _
ByVal keyData As Keys) As Boolean
If (keyData And Keys.KeyCode) = Keys.Tab OrElse (...
'***現在の行
Dim col As Integer
Dim row As Integer = Me.CurrentCell.RowIndex
If (keyData And Keys.Shift) = Keys.Shift Then
col = Me.CurrentCell.ColumnIndex - 1
Else
col = Me.CurrentCell.ColumnIndex + 1
End If
While 0 <= col AndAlso col < Me.Columns.Count...
If (keyData And Keys.Shift) = Keys.Shift ...
col -= 1
Else
col += 1
End If
End While
If col < 0 Then
row -= 1
ElseIf Me.ColumnCount <= col Then
row += 1
End If
If 0 <= row AndAlso row < Me.RowCount Then
If col < 0 Then
Return MyBase.ProcessDialogKey(keyData)
ElseIf 0 <= col AndAlso col < Me.Columns....
'***現在の行
Me.CurrentCell = Me.Rows(Me.CurrentCe...
Else
'***次行
col = 0
While col < Me.Columns.Count AndAlso ...
col += 1
End While
If row < Me.RowCount AndAlso col < Me...
Me.CurrentCell = Me.Rows(row).Cel...
End If
End If
Return True
ElseIf Me.RowCount <= col Then
'Me.SelectNextControl(Me, True, True, Tru...
End If
End If
Return MyBase.ProcessDialogKey(keyData)
End Function
<System.Security.Permissions.SecurityPermission( _
System.Security.Permissions.SecurityAction.Demand...
Flags:=System.Security.Permissions.SecurityPermis...
Protected Overrides Function ProcessDataGridViewKey( _
ByVal e As KeyEventArgs) As Boolean
If (e.KeyData And Keys.KeyCode) = Keys.Tab OrElse...
Dim col As Integer
Dim row As Integer = Me.CurrentCell.RowIndex
If e.Shift Then
'シフトTABのときの動き
col = Me.CurrentCell.ColumnIndex - 1
While 0 <= col AndAlso Me.Columns(col).Re...
col -= 1
End While
If col < 0 Then
row -= 1
If 0 < row Then
Return Me.FindForm().SelectNextCo...
ElseIf 0 <= row AndAlso row < Me.RowC...
'***前行
col = Me.Columns.Count - 1
While 0 <= col AndAlso Me.Rows(ro...
col -= 1
End While
Me.CurrentCell = Me.Rows(row).Cel...
Return True
End If
Else
'***現在の行
Me.CurrentCell = Me.Rows(Me.CurrentCe...
Return True
End If
Else
'TABのときの動き
col = Me.CurrentCell.ColumnIndex + 1
While col < Me.Columns.Count AndAlso Me.C...
col += 1
End While
If Me.ColumnCount <= col Then
row += 1
'***次行
col = 0
While col < Me.Columns.Count AndAlso ...
col += 1
End While
If row < Me.RowCount Then
Me.CurrentCell = Me.Rows(row).Cel...
Return True
Else
e.Handled = False
Me.FindForm().SelectNextControl(M...
Return True
End If
Else
If 0 <= col AndAlso col < Me.Columns....
'***現在の行
Me.CurrentCell = Me.Rows(row).Cel...
Return True
End If
End If
End If
End If
Return MyBase.ProcessDataGridViewKey(e)
End Function
では、よりいいコントロールボックスを作成してください。
//これより下は編集しないでください
#pageinfo(,2013-12-15 (日) 21:29:39,,2013-12-15 (日) 21:2...
終了行:
*自由区/.NET Tipsの器/DaraGridViewの使用方法/実用 [#x99ec...
下記のファイル名(コントロール継承ファイルに追加)
ファイル名
DataGridVeiwEx.Designer.vb
<System.Security.Permissions.UIPermission( _
System.Security.Permissions.SecurityAction.Demand...
Window:=System.Security.Permissions.UIPermissionW...
Protected Overrides Function ProcessDialogKey( _
ByVal keyData As Keys) As Boolean
If (keyData And Keys.KeyCode) = Keys.Tab OrElse (...
'***現在の行
Dim col As Integer
Dim row As Integer = Me.CurrentCell.RowIndex
If (keyData And Keys.Shift) = Keys.Shift Then
col = Me.CurrentCell.ColumnIndex - 1
Else
col = Me.CurrentCell.ColumnIndex + 1
End If
While 0 <= col AndAlso col < Me.Columns.Count...
If (keyData And Keys.Shift) = Keys.Shift ...
col -= 1
Else
col += 1
End If
End While
If col < 0 Then
row -= 1
ElseIf Me.ColumnCount <= col Then
row += 1
End If
If 0 <= row AndAlso row < Me.RowCount Then
If col < 0 Then
Return MyBase.ProcessDialogKey(keyData)
ElseIf 0 <= col AndAlso col < Me.Columns....
'***現在の行
Me.CurrentCell = Me.Rows(Me.CurrentCe...
Else
'***次行
col = 0
While col < Me.Columns.Count AndAlso ...
col += 1
End While
If row < Me.RowCount AndAlso col < Me...
Me.CurrentCell = Me.Rows(row).Cel...
End If
End If
Return True
ElseIf Me.RowCount <= col Then
'Me.SelectNextControl(Me, True, True, Tru...
End If
End If
Return MyBase.ProcessDialogKey(keyData)
End Function
<System.Security.Permissions.SecurityPermission( _
System.Security.Permissions.SecurityAction.Demand...
Flags:=System.Security.Permissions.SecurityPermis...
Protected Overrides Function ProcessDataGridViewKey( _
ByVal e As KeyEventArgs) As Boolean
If (e.KeyData And Keys.KeyCode) = Keys.Tab OrElse...
Dim col As Integer
Dim row As Integer = Me.CurrentCell.RowIndex
If e.Shift Then
'シフトTABのときの動き
col = Me.CurrentCell.ColumnIndex - 1
While 0 <= col AndAlso Me.Columns(col).Re...
col -= 1
End While
If col < 0 Then
row -= 1
If 0 < row Then
Return Me.FindForm().SelectNextCo...
ElseIf 0 <= row AndAlso row < Me.RowC...
'***前行
col = Me.Columns.Count - 1
While 0 <= col AndAlso Me.Rows(ro...
col -= 1
End While
Me.CurrentCell = Me.Rows(row).Cel...
Return True
End If
Else
'***現在の行
Me.CurrentCell = Me.Rows(Me.CurrentCe...
Return True
End If
Else
'TABのときの動き
col = Me.CurrentCell.ColumnIndex + 1
While col < Me.Columns.Count AndAlso Me.C...
col += 1
End While
If Me.ColumnCount <= col Then
row += 1
'***次行
col = 0
While col < Me.Columns.Count AndAlso ...
col += 1
End While
If row < Me.RowCount Then
Me.CurrentCell = Me.Rows(row).Cel...
Return True
Else
e.Handled = False
Me.FindForm().SelectNextControl(M...
Return True
End If
Else
If 0 <= col AndAlso col < Me.Columns....
'***現在の行
Me.CurrentCell = Me.Rows(row).Cel...
Return True
End If
End If
End If
End If
Return MyBase.ProcessDataGridViewKey(e)
End Function
では、よりいいコントロールボックスを作成してください。
//これより下は編集しないでください
#pageinfo(,2013-12-15 (日) 21:29:39,,2013-12-15 (日) 21:2...
ページ名:
▲
▼
[
トップ
] [
新規
|
子ページ作成
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]