本文整理汇总了VB.NET中System.Windows.Forms.DataGridTextBoxColumn.Edit方法的典型用法代码示例。如果您正苦于以下问题:VB.NET DataGridTextBoxColumn.Edit方法的具体用法?VB.NET DataGridTextBoxColumn.Edit怎么用?VB.NET DataGridTextBoxColumn.Edit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.DataGridTextBoxColumn
的用法示例。
在下文中一共展示了DataGridTextBoxColumn.Edit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: Form1
Public Class Form1
Inherits Form
Protected dataGrid1 As DataGrid
Protected myDataSet As DataSet
Private Sub dataGrid1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)
' Use the HitTest method to get a HitTestInfo object.
Dim hi As DataGrid.HitTestInfo
Dim grid As DataGrid = CType(sender, DataGrid)
hi = grid.HitTest(e.X, e.Y)
' Test if the clicked area was a cell.
If hi.Type = DataGrid.HitTestType.Cell Then
' If it's a cell, get the GridTable and CurrencyManager of the
' clicked table.
Dim dgt As DataGridTableStyle = dataGrid1.TableStyles(0)
Dim cm As CurrencyManager = CType _
(Me.BindingContext(myDataSet.Tables(dgt.MappingName)), _
CurrencyManager)
' Get the Rectangle of the clicked cell.
Dim cellRect As Rectangle = _
grid.GetCellBounds(hi.Row, hi.Column)
' Get the clicked DataGridTextBoxColumn.
Dim gridCol As MyGridColumn = CType _
(dgt.GridColumnStyles(hi.Column), MyGridColumn)
' Edit the value.
gridCol.EditCol(cm, hi.Row, cellRect, False, "New Text", True)
End If
End Sub
End Class
Public Class MyGridColumn
Inherits DataGridTextBoxColumn
Public Sub EditCol(cm As CurrencyManager , rowNum As integer , _
cellRect As Rectangle , bReadOnly As Boolean , _
myString As String , isVisible As Boolean )
me.Edit(cm, rowNum, cellRect, bReadOnly, myString, isVisible)
End Sub
End Class