就一行代码:
FarPoint.Win.Spread.Design.ExternalDialogs.CellTypeEditor(fpSpread1);
右击菜单调用后,默认类别是条码对吧,选择下拉框为其他类别的时候,默认传递的单元格值是不保留的。
其实以上的不是关键问题,关键的问题是能够实现按照类别调用设置框并总能传递值。
- Private Sub SetCellType(ByVal sender As System.Object, ByVal e As System.EventArgs) _
- Handles MCellType_Progress.Click, MCellType_Percent.Click, MCellType_Number.Click, _
- MCellType_MultiOption.Click, MCellType_MultiColumnComboBox.Click, MCellType_Mask.Click, MCellType_ListBox.Click, _
- MCellType_Label.Click, MCellType_Image.Click, MCellType_HyperLink.Click, MCellType_General.Click, _
- MCellType_DateTime.Click, MCellType_Currency.Click, MCellType_ComboBox.Click, MCellType_ColorPicker.Click, _
- MCellType_CheckBox.Click, MCellType_Button.Click, MCellType_BarCode.Click, MCellType_Text.Click, _
- MCellType_Slider.Click, MCellType_RichText.Click, MCellType_RegularExpression.Click, MCellTypeClear.Click
- FarPoint.Win.Spread.Design.common.LoadResourceManagerForStrings()
- Dim ctd As CellTypeDlgV3 = New CellTypeDlgV3(spreadArea)
- Dim typeFlag As Boolean = True
- Select Case sender.name()
- Case "MCellType_Progress"
- ctd.celltype = DesignerMain.CellTypeEnum.ProgressCellType
- Case "MCellType_Percent"
- ctd.celltype = DesignerMain.CellTypeEnum.PercentCellType
- Case "MCellType_Number"
- ctd.celltype = DesignerMain.CellTypeEnum.NumberCellType
- Case "MCellType_MultiOption"
- ctd.celltype = DesignerMain.CellTypeEnum.MultiOptionCellType
- Case "MCellType_MultiColumnComboBox"
- ctd.celltype = DesignerMain.CellTypeEnum.MultiColumnComboBoxCellType
- Case "MCellType_Mask"
- ctd.celltype = DesignerMain.CellTypeEnum.MaskCellType
- Case "MCellType_ListBox"
- ctd.celltype = DesignerMain.CellTypeEnum.ListBoxCellType
- Case "MCellType_Label"
- ctd.celltype = DesignerMain.CellTypeEnum.LabelCellType
- Case "MCellType_Image"
- ctd.celltype = DesignerMain.CellTypeEnum.ImageCellType
- Case "MCellType_HyperLink"
- ctd.celltype = DesignerMain.CellTypeEnum.LinkCellType
- Case "MCellType_General"
- ctd.celltype = DesignerMain.CellTypeEnum.GeneralCellType
- Case "MCellType_DateTime"
- ctd.celltype = DesignerMain.CellTypeEnum.DateTimeCellType
- Case "MCellType_Currency"
- ctd.celltype = DesignerMain.CellTypeEnum.CurrencyCellType
- Case "MCellType_ComboBox"
- ctd.celltype = DesignerMain.CellTypeEnum.ComboCellType
- Case "MCellType_ColorPicker"
- ctd.celltype = DesignerMain.CellTypeEnum.ColorPickerCellType
- Case "MCellType_CheckBox"
- ctd.celltype = DesignerMain.CellTypeEnum.CheckBoxCellType
- Case "MCellType_Button"
- ctd.celltype = DesignerMain.CellTypeEnum.ButtonCellType
- Case "MCellType_BarCode"
- ctd.celltype = DesignerMain.CellTypeEnum.BarcodeCellType
- Case "MCellType_Text"
- ctd.celltype = DesignerMain.CellTypeEnum.TextCellType
- Case "MCellType_Slider"
- ctd.celltype = DesignerMain.CellTypeEnum.SliderCellType
- Case "MCellType_RichText"
- ctd.celltype = DesignerMain.CellTypeEnum.RichTextCellType
- Case "MCellType_RegularExpression"
- ctd.celltype = DesignerMain.CellTypeEnum.RegExCellType
- Case "MCellTypeClear"
- typeFlag = False
- spreadArea.ActiveSheet.ActiveCell.ResetCellType()
- Case Else
- typeFlag = False
- FarPoint.Win.Spread.Design.ExternalDialogs.CellTypeEditor(spreadArea)
- End Select
- If typeFlag = True Then
- ctd.InitValues(spreadArea.ActiveSheet.ActiveCell.CellType, spreadArea.ActiveSheet.ActiveCell.Value)
- ctd.ShowDialog()
- End If
- End Sub
复制代码 |