谢谢,问题解决了,不过貌似需要把subeditor指向原来的单元格,最终代码为(列宽的调整也放里面了)
Private Sub Fptag_SubEditorOpening(sender As Object, e As SubEditorOpeningEventArgs) Handles Fptag.SubEditorOpening
If Fptag.ActiveSheet.Cells(e.Row, e.Column).CellType.ToString = "MultiColumnComboBoxCellType" Then
Dim subEditor As FarPoint.Win.Spread.FpSpread = e.SubEditor
subEditor.ActiveSheet.Columns(subEditor.ActiveSheet.Columns.Count - 1).Width = 0
For i = 0 To subEditor.ActiveSheet.NonEmptyColumnCount - 2
subEditor.ActiveSheet.ColumnHeader.Cells(0, i).Renderer = err
Dim s = subEditor.ActiveSheet.Columns(i).GetPreferredWidth
Dim s2 = subEditor.ActiveSheet.ColumnHeader.Columns(i).Width
If s > s2 Then
subEditor.ActiveSheet.Columns(i).Width = s + 1
Else
subEditor.ActiveSheet.Columns(i).Width = s2 + 1
End If
Next
Fptag.ActiveSheet.Cells(e.Row, e.Column).CellType = subEditor.ActiveSheet.ActiveCell.CellType
End If
End Sub |