本文整理汇总了VB.NET中System.Windows.Forms.DataGridViewAdvancedBorderStyle类的典型用法代码示例。如果您正苦于以下问题:VB.NET DataGridViewAdvancedBorderStyle类的具体用法?VB.NET DataGridViewAdvancedBorderStyle怎么用?VB.NET DataGridViewAdvancedBorderStyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DataGridViewAdvancedBorderStyle类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: Main
' 导入命名空间
Imports System.Drawing
Imports System.Windows.Forms
Namespace DataGridViewAdvancedBorderStyleSample
Class Form1
Inherits Form
<STAThreadAttribute()> _
Public Shared Sub Main()
Application.EnableVisualStyles()
Application.Run(New Form1())
End Sub
Public Sub New()
Me.AutoSize = True
Me.Controls.Add(New CustomDataGridView())
Me.Text = "DataGridView advanced border styles demo"
End Sub
End Class
Public Class CustomDataGridView
Inherits DataGridView
Public Sub New()
With Me
.RowTemplate = New DataGridViewCustomRow()
.Columns.Add(New DataGridViewCustomColumn())
.Columns.Add(New DataGridViewCustomColumn())
.Columns.Add(New DataGridViewCustomColumn())
.RowCount = 4
.EnableHeadersVisualStyles = False
.AutoSize = True
End With
End Sub
Public Overrides ReadOnly Property AdjustedTopLeftHeaderBorderStyle() _
As DataGridViewAdvancedBorderStyle
Get
Dim newStyle As New DataGridViewAdvancedBorderStyle()
With newStyle
.Top = DataGridViewAdvancedCellBorderStyle.None
.Left = DataGridViewAdvancedCellBorderStyle.None
.Bottom = DataGridViewAdvancedCellBorderStyle.Outset
.Right = DataGridViewAdvancedCellBorderStyle.OutsetDouble
End With
Return newStyle
End Get
End Property
Public Overrides Function AdjustColumnHeaderBorderStyle( _
ByVal dataGridViewAdvancedBorderStyleInput As DataGridViewAdvancedBorderStyle, _
ByVal dataGridViewAdvancedBorderStylePlaceHolder As DataGridViewAdvancedBorderStyle, _
ByVal firstDisplayedColumn As Boolean, ByVal lastVisibleColumn As Boolean) _
As DataGridViewAdvancedBorderStyle
' Customize the left border of the first column header and the
' bottom border of all the column headers. Use the input style for
' all other borders.
If firstDisplayedColumn Then
dataGridViewAdvancedBorderStylePlaceHolder.Left = _
DataGridViewAdvancedCellBorderStyle.OutsetDouble
Else
dataGridViewAdvancedBorderStylePlaceHolder.Left = _
DataGridViewAdvancedCellBorderStyle.None
End If
With dataGridViewAdvancedBorderStylePlaceHolder
.Bottom = DataGridViewAdvancedCellBorderStyle.Single
.Right = dataGridViewAdvancedBorderStyleInput.Right
.Top = dataGridViewAdvancedBorderStyleInput.Top
End With
Return dataGridViewAdvancedBorderStylePlaceHolder
End Function
End Class
Public Class DataGridViewCustomColumn
Inherits DataGridViewColumn
Public Sub New()
Me.CellTemplate = New DataGridViewCustomCell()
End Sub
End Class
Public Class DataGridViewCustomCell
Inherits DataGridViewTextBoxCell
Public Overrides Function AdjustCellBorderStyle( _
ByVal dataGridViewAdvancedBorderStyleInput As DataGridViewAdvancedBorderStyle, _
ByVal dataGridViewAdvancedBorderStylePlaceHolder As DataGridViewAdvancedBorderStyle, _
ByVal singleVerticalBorderAdded As Boolean, _
ByVal singleHorizontalBorderAdded As Boolean, _
ByVal firstVisibleColumn As Boolean, _
ByVal firstVisibleRow As Boolean) As DataGridViewAdvancedBorderStyle
' Customize the top border of cells in the first row and the
' right border of cells in the first column. Use the input style
' for all other borders.
If firstVisibleColumn Then
dataGridViewAdvancedBorderStylePlaceHolder.Left = _
DataGridViewAdvancedCellBorderStyle.OutsetDouble
Else
dataGridViewAdvancedBorderStylePlaceHolder.Left = _
DataGridViewAdvancedCellBorderStyle.None
End If
If firstVisibleRow Then
dataGridViewAdvancedBorderStylePlaceHolder.Top = _
DataGridViewAdvancedCellBorderStyle.InsetDouble
Else
dataGridViewAdvancedBorderStylePlaceHolder.Top = _
DataGridViewAdvancedCellBorderStyle.None
End If
With dataGridViewAdvancedBorderStylePlaceHolder
.Right = dataGridViewAdvancedBorderStyleInput.Right
.Bottom = dataGridViewAdvancedBorderStyleInput.Bottom
End With
Return dataGridViewAdvancedBorderStylePlaceHolder
End Function
End Class
Public Class DataGridViewCustomRow
Inherits DataGridViewRow
Public Overrides Function AdjustRowHeaderBorderStyle( _
ByVal dataGridViewAdvancedBorderStyleInput As DataGridViewAdvancedBorderStyle, _
ByVal dataGridViewAdvancedBorderStylePlaceHolder As DataGridViewAdvancedBorderStyle, _
ByVal singleVerticalBorderAdded As Boolean, _
ByVal singleHorizontalBorderAdded As Boolean, _
ByVal isFirstDisplayedRow As Boolean, _
ByVal isLastDisplayedRow As Boolean) As DataGridViewAdvancedBorderStyle
' Customize the top border of the first row header and the
' right border of all the row headers. Use the input style for
' all other borders.
If isFirstDisplayedRow Then
dataGridViewAdvancedBorderStylePlaceHolder.Top = _
DataGridViewAdvancedCellBorderStyle.InsetDouble
Else
dataGridViewAdvancedBorderStylePlaceHolder.Top = _
DataGridViewAdvancedCellBorderStyle.None
End If
With dataGridViewAdvancedBorderStylePlaceHolder
.Right = DataGridViewAdvancedCellBorderStyle.OutsetDouble
.Left = dataGridViewAdvancedBorderStyleInput.Left
.Bottom = dataGridViewAdvancedBorderStyleInput.Bottom
End With
Return dataGridViewAdvancedBorderStylePlaceHolder
End Function
End Class
End Namespace
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:159,代码来源:DataGridViewAdvancedBorderStyle
注:本文中的System.Windows.Forms.DataGridViewAdvancedBorderStyle类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论