Public Class myCkBox
Inherits FarPoint.Win.Spread.CellType.CheckBoxCellType
Dim ckbx As New CheckBox()
Sub New()
End Sub
Public Shadows Event EditingStopped(ByVal sender As Object, ByVal e As EventArgs)
Public Shadows Event EditingCancelled(ByVal sender As Object, ByVal e As EventArgs)
Public Overrides Sub StartEditing(ByVal e As EventArgs, ByVal selectAll As Boolean, ByVal autoClipboard As Boolean)
MyBase.StartEditing(e, selectAll, autoClipboard)
End Sub
Public Overrides Sub CancelEditing()
RaiseEvent EditingCancelled(ckbx, EventArgs.Empty)
MyBase.FireEditingCanceled()
End Sub
Public Overrides Function StopEditing() As Boolean
RaiseEvent EditingStopped(ckbx, EventArgs.Empty)
MyBase.FireEditingStopped()
Return True
End Function
Public Overrides Function IsReservedKey(ByVal e As KeyEventArgs) As Boolean
Return MyBase.IsReservedKey(e)
End Function
Public Overrides Function IsReservedLocation(ByVal g As Graphics, ByVal x As Integer, ByVal y As Integer, ByVal r As Rectangle,
ByVal appr As FarPoint.Win.Spread.Appearance, ByVal value As Object, ByVal zoom As Single) As Object
Return MyBase.IsReservedLocation(g, x, y, r, appr, value, zoom)
End Function
Public Overrides Function GetPreferredSize(ByVal g As Graphics, ByVal s As Size, ByVal appr As FarPoint.Win.Spread.Appearance,
ByVal value As Object, ByVal zoom As Single) As Size
Return MyBase.GetPreferredSize(g, s, appr, value, zoom)
End Function
Public Overrides Function Parse(ByVal s As String) As Object
Return MyBase.Parse(s)
End Function
Public Overrides Function Format(ByVal o As Object) As String
Return MyBase.Format(o)
End Function
Public Overrides Function GetEditorControl(ByVal appr As FarPoint.Win.Spread.Appearance, ByVal zoom As Single) As Control
Return ckbx
End Function
Public Overrides Function GetEditorValue() As Object
Return ckbx.CheckState
End Function
Public Overrides Sub PaintCell(ByVal g As Graphics, ByVal r As Rectangle, ByVal appr As FarPoint.Win.Spread.Appearance, ByVal
Value As Object, ByVal issel As Boolean, ByVal islocked As Boolean, ByVal zoom As Single)
GetEditorValue()
If ckbx.CheckState = CheckState.Checked Then
ControlPaint.DrawCheckBox(g, r.X, r.Y, r.Width - 40, r.Height - 6, ButtonState.Checked)
ElseIf ckbx.CheckState = CheckState.Unchecked Then
ControlPaint.DrawCheckBox(g, r.X, r.Y, r.Width - 40, r.Height - 6, ButtonState.Normal)
End If
End Sub
Public Overrides Sub SetEditorValue(ByVal value As Object)
ckbx.CheckState = CheckState.Checked
End Sub
Public Overrides Function GetReservedCursor(ByVal o As Object) As Cursor
Return MyBase.GetReservedCursor(o)
End Function
End Class
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
Dim ckbx As New myCkBox()
fpSpread1.ActiveSheet.Cells(0, 0).CellType = ckbx
End Sub