问题说明:当按下面代码写好程序后,第一次点击单元格时,能够出现带...的小按钮,第二次无论点击任何单元格,都不再显示。请教解决办法。谢谢。
1.创建一winform应用程序,在form1中放入spread控件
2.加入下列代码:
- private void Form1_Load(object sender, EventArgs e)
- {
- FPTextCellType t = new FPTextCellType();
- fpSpread1_Sheet1.Columns.Count = 1;
- fpSpread1_Sheet1.Columns[0].CellType = t;
- }
复制代码
其中的FPTextCellType 为自定义类,代码如下
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- using System.Data;
- using FarPoint.Win.Spread;
- using FarPoint.Win.Spread.CellType;
- using System.Drawing.Printing;
- using FarPoint.Win;
- using System.Drawing.Drawing2D;
- using System.Globalization;
- using FarPoint.Win.Spread.Model;
- using Microsoft.Win32;
- namespace Test
- {
- public class FPTextCellType : TextCellType
- {
- public override Control GetEditorControl(FarPoint.Win.Spread.Appearance appearance, float zoomFactor)
- {
- appearance.BackColor = Color.Red;
- Control c = base.GetEditorControl(appearance, zoomFactor);
-
- ((GeneralEditor)c).ButtonStyle = ButtonStyle.PopUp;
- return c;
- }
- protected override void FireEditorValueChanged(EventArgs e)
- {
- base.FireEditorValueChanged(e);
- }
- }
- }
复制代码 |
|