本文整理汇总了VB.NET中System.Windows.Forms.DataGridTextBoxColumn.GetPreferredSize方法的典型用法代码示例。如果您正苦于以下问题:VB.NET DataGridTextBoxColumn.GetPreferredSize方法的具体用法?VB.NET DataGridTextBoxColumn.GetPreferredSize怎么用?VB.NET DataGridTextBoxColumn.GetPreferredSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.DataGridTextBoxColumn
的用法示例。
在下文中一共展示了DataGridTextBoxColumn.GetPreferredSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: Form1
Public Class Form1
Inherits Form
Protected dataGrid1 As DataGrid
Private Sub GetPreferredSize()
Dim g As Graphics
g = Me.CreateGraphics()
Dim gridPreferredSize As Size
Dim myTextColumn As MyGridColumn
' Assuming column 1 of a DataGrid control is a
' DataGridTextBoxColumn.
myTextColumn = CType(dataGrid1.TableStyles(0). _
GridColumnStyles(1), MyGridColumn)
Dim myVal As String
myVal = "A long string value"
gridPreferredSize = myTextColumn.GetPrefSize _
(g, myVal)
Console.WriteLine(gridPreferredSize)
End Sub
End Class
Public Class MyGridColumn
Inherits DataGridTextBoxColumn
public Function GetPrefSize(g As Graphics , val As string) _
As Size
return me.GetPreferredSize(g, val)
End Function
End Class