TS said:
Who knows how to make the actual check box rectangle
larger? Is the onlyway to inherit from checkbox and override its
paint method or something?
Yes.
Very quick and dirty:
\\\
Option Explicit On
Option Strict On
Public Class CheckBoxEx
Inherits System.Windows.Forms.CheckBox
Private Sub CheckBoxEx_Paint( _
ByVal sender As Object, _
ByVal e As System.Windows.Forms.PaintEventArgs _
) Handles MyBase.Paint
Dim rct As Rectangle = _
New Rectangle( _
0, _
CInt((Me.Height - Me.Font.Size) * 0.5), _
CInt(Me.Font.Size), CInt(Me.Font.Size) _
)
e.Graphics.FillRectangle( _
Brushes.Black, _
New Rectangle(0, 0, Me.Width, Me.Height) _
)
Select Case Me.CheckState
Case CheckState.Checked
e.Graphics.FillRectangle(Brushes.Red, rct)
Case CheckState.Indeterminate
e.Graphics.FillRectangle(Brushes.Green, rct)
Case CheckState.Unchecked
e.Graphics.FillRectangle(Brushes.Blue, rct)
End Select
Dim ForeBrush As New SolidBrush(Me.ForeColor)
e.Graphics.DrawString( _
Me.Text, _
Me.Font, _
ForeBrush, _
CInt(Me.Font.Size + 4), _
CInt((Me.Height - Me.Font.Size) * 0.5) _
)
ForeBrush.Dispse()
End Sub
Private Sub CheckBoxEx_CheckStateChanged( _
ByVal sender As Object, _
ByVal e As System.EventArgs _
) Handles MyBase.CheckStateChanged
Me.Invalidate()
End Sub
End Class
///