1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
Public Class PricingDataGrid
Inherits System.Windows.Forms.DataGridView
Public Sub New()
'Setup The DatagridView
Dim ColumnHeaderStyle As New DataGridViewCellStyle
ColumnHeaderStyle.Font = New Font("Arial", 8, FontStyle.Bold, GraphicsUnit.Point)
ColumnHeaderStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
For Each Column As DataGridViewColumn In Me.Columns
Column.HeaderCell.Style = ColumnHeaderStyle
Column.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
Column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
Next Column
With Me
.Columns("Strikes").DefaultCellStyle.BackColor = Color.LightGray
.Columns("Strikes").DefaultCellStyle.Font = New Font("Arial", 8, FontStyle.Bold, GraphicsUnit.Point)
.Columns("Put Fair Value").DefaultCellStyle.BackColor = Color.LightBlue
.Columns("Put Fair Value").DefaultCellStyle.Font = New Font("Arial", 8, FontStyle.Bold, GraphicsUnit.Point)
.Columns("Call Fair Value").DefaultCellStyle.BackColor = Color.LightYellow
.Columns("Call Fair Value").DefaultCellStyle.Font = New Font("Arial", 8, FontStyle.Bold, GraphicsUnit.Point)
.ReadOnly = True
.AllowDrop = False
.RowHeadersVisible = False
.AllowUserToAddRows = False
.AllowUserToResizeRows = False
.AllowUserToDeleteRows = False
.AllowUserToOrderColumns = False
.AllowUserToResizeColumns = False
End With
End Sub
End Class |
Partager