Visual Basic (Usage) | Copy Code |
---|---|
Dim instance As CheckBoxCellType Dim o As Object Dim value As String value = instance.Format(o) |
Parameters
- o
- Object in the data model from which to get formatting information
Return Value
Formatted string to put in the cell on the sheetThe following example subclasses the CheckBoxCellType class and creates a check box cell in the first cell of the spreadsheet. Its checked and unchecked images are set in the constructor and it uses the values of 0 or 1 for the check box state.
C# | Copy Code |
---|---|
[Serializable()] class myCheck:FarPoint.Web.Spread.CheckBoxCellType { Public myCheck(string img1,string img2) { Base.CheckedImageUrl=img1; Base.UncheckedImageUrl=img2; } Public override string Format(object o) { return Base.Format(o); } Public override Control GetEditorControl(string id,TableCell tc,FarPoint.Web.Spread.Appearance style,FarPoint.Web.Spread.Inset margin,object v,bool ul) { return Base.GetEditorControl(id,tc,style,margin,v,ul); } public override object GetEditorValue(Control owner,string id) { return Base.GetEditorValue(owner,id); } public override Control PaintCell(string id,TableCell tc,FarPoint.Web.Spread.Appearance style,FarPoint.Web.Spread.Inset margin,object v,bool ul) { return Base.PaintCell(id,tc,style,margin,v,ul); } public override object Parse(string s) { return Base.Parse(s); } public override bool ValidateEditorValue(object val,string outreason) { return Base.ValidateEditorValue(val,outreason); } new public bool BooleanValue { Get { return Base.BooleanValue; } Set { Base.BooleanValue=value; } } Public override string EditorClientScriptUrl{Get{Return"checkboxeditor.htc";}} Public override string RendererClientScriptUrl{Get{Return"checkboxrender.htc";}} } private void Page_Load(object sender, System.EventArgs e) { myCheckckbox= new myCheck("img/checked.gif","img/unchecked.gif"); ckbox.BooleanValue=false; FpSpread1.ActiveSheetView.Cells[0,0].CellType=ckbox; FpSpread1.ActiveSheetView.SetValue(0,0,1); } |
Visual Basic | Copy Code |
---|---|
<Serializable()> Public Class myCheck Inherits FarPoint.Web.Spread.CheckBoxCellType Sub New(ByVal img1 As String,ByVal img2 As String) MyBase.CheckedImageUrl=img1 MyBase.UncheckedImageUrl=img2 End Sub Public Overrides Function Format(ByVal o As Object)As String Return MyBase.Format(o) End Function Public Overrides Function GetEditorControl(ByVal id As String,ByVal tc As TableCell,ByVal style As FarPoint.Web.Spread.Appearance,ByVal margin As FarPoint.Web.Spread.Inset,ByVal v As Object,ByVal ul As Boolean)As System.Web.UI.Control Return MyBase.GetEditorControl(id,tc,style,margin,v,ul) End Function Public Overrides Function GetEditorValue(ByVal owner As Control,ByVal id As String)As Object Return MyBase.GetEditorValue(owner,id) End Function Public Overrides Function PaintCell(ByVal id As String,ByVal tc As TableCell,ByVal style As FarPoint.Web.Spread.Appearance,ByVal margin As FarPoint.Web.Spread.Inset,ByVal v As Object,ByVal ul As Boolean)As System.Web.UI.Control Return MyBase.PaintCell(id,tc,style,margin,v,ul) End Function Public Overrides Function Parse(ByVal s As String)As Object Return MyBase.Parse(s) End Function Public Overrides Function ValidateEditorValue(ByVal val As Object,ByRef reason As String)As Boolean Return MyBase.ValidateEditorValue(val,reason) End Function Public ShadowsPropertyBooleanValue()As Boolean Get Return MyBase.BooleanValue EndGet Set(ByVal Value A sBoolean) MyBase.BooleanValue=Value End Set End Property Public ShadowsPropertyCheckedImageUrl() As String Get Return MyBase.CheckedImageUrl End Get Set(ByVal Value As String) MyBase.CheckedImageUrl=Value End Set End Property Public Overrides ReadOnly PropertyEditorClientScriptUrl()As String Get Return"checkboxeditor.htc" End Get End Property Public Overrides ReadOnly PropertyRendererClientScriptUrl()As String Get Return"checkboxrender.htc" End Get End Property Public ShadowsPropertyUncheckedImageUrl()As String Get Return MyBase.UncheckedImageUrl End Get Set(ByVal Value As String) MyBase.UncheckedImageUrl=Value End Set End Property End Class Private Sub Page_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles MyBase.Load Dim ckbox As New myCheck("img\checked.gif","img\unchecked.gif") ckbox.BooleanValue=False FpSpread1.ActiveSheetView.Cells(0,0).CellType=ckbox FpSpread1.ActiveSheetView.SetValue(0,0,1) End Sub |
Target Platforms: Windows 7, Windows 8, Windows Vista, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6