N
nate axtell
I'm trying to create a custom DataGridBoolColumn. I inherit
DataGridColumnStyle and create a public CheckBox variable. This columnType
will be mapped to a dataTable boolean column. What are the basics of the
Draw and Edit methods that I need to implement in order to see the checkbox
in the cell?
I have tried the following, but it hasn't worked. (CB is the public
checkbox):
Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal bounds As
Rectangle, ByVal [source] As CurrencyManager, ByVal rowNum As Integer, ByVal
backBrush As Brush, ByVal foreBrush As Brush, ByVal alignToRight As Boolean)
Dim value As Boolean
If IsDBNull(GetColumnValueAtRow([source], rowNum)) Then
value = False
Else
value = CBool(GetColumnValueAtRow([source], rowNum))
End If
CB.Visible = True
CB.Location = New Point(bounds.Left, bounds.Top)
CB.Checked = value
CB.Show()
CB.Focus()
CB.BringToFront()
End Sub
Protected Overloads Overrides Sub Edit(...)
CB.Visible = True
CB.Location = New Point(bounds.Left, bounds.Top)
CB.Checked = value
CB.Show()
CB.Focus()
End Sub
DataGridColumnStyle and create a public CheckBox variable. This columnType
will be mapped to a dataTable boolean column. What are the basics of the
Draw and Edit methods that I need to implement in order to see the checkbox
in the cell?
I have tried the following, but it hasn't worked. (CB is the public
checkbox):
Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal bounds As
Rectangle, ByVal [source] As CurrencyManager, ByVal rowNum As Integer, ByVal
backBrush As Brush, ByVal foreBrush As Brush, ByVal alignToRight As Boolean)
Dim value As Boolean
If IsDBNull(GetColumnValueAtRow([source], rowNum)) Then
value = False
Else
value = CBool(GetColumnValueAtRow([source], rowNum))
End If
CB.Visible = True
CB.Location = New Point(bounds.Left, bounds.Top)
CB.Checked = value
CB.Show()
CB.Focus()
CB.BringToFront()
End Sub
Protected Overloads Overrides Sub Edit(...)
CB.Visible = True
CB.Location = New Point(bounds.Left, bounds.Top)
CB.Checked = value
CB.Show()
CB.Focus()
End Sub