找回密码
 立即注册

QQ登录

只需一步,快速开始

sheep

论坛元老

21

主题

83

帖子

2万

积分

论坛元老

积分
20121

活字格认证

[已处理] 单元格事件触发

sheep
论坛元老   /  发表于:2012-8-30 13:12  /   查看:9408  /  回复:14
dof你好,又来麻烦你了
1.jpg (56.64 KB, 下载次数: 319)

14 个回复

倒序浏览
wjjw
中级会员   /  发表于:2012-8-30 13:34:00
沙发
同问。。。
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-8-30 13:47:00
板凳
回复 1楼sheep的帖子

你好,
不好意思,需要确认下,1#图片中有多种单元格类型,请问指的是哪一种。
根据单元格类型的不同触发方式有所不同,大多是通过单元格类型下事件触发,例如:ComboBoxCellType

  1. private void Form1_Load(object sender, EventArgs e)
  2.         {
  3.             FarPoint.Win.Spread.CellType.ComboBoxCellType cellType = new FarPoint.Win.Spread.CellType.ComboBoxCellType();
  4.             cellType.EditorValueChanged += new EventHandler(cellType_EditorValueChanged);
  5.             cellType.Items = new string[] {"1","2","3" };
  6.             this.fpSpread1.Sheets[0].Cells[0, 0].CellType = cellType;
  7.         }

  8.         void cellType_EditorValueChanged(object sender, EventArgs e)
  9.         {

  10.         }
复制代码
回复 使用道具 举报
wjjw
中级会员   /  发表于:2012-8-30 15:59:00
地板
多谢!   如果我想指定不同的ITEM触发不同的事件该怎么写呢
比如上面例子
cellType.Items = new string[] {"1","2","3" };
在选择“1” "2"  "3"  时分别输出不同数字
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-8-30 18:12:00
5#
回复 4楼wjjw的帖子

你好,请使用以下代码测试:

  1.         void cellType_EditorValueChanged(object sender, EventArgs e)
  2.         {
  3.             switch (this.fpSpread1.Sheets[0].Cells[0,0].Text)
  4.             {
  5.                 case "1":
  6.                     MessageBox.Show("1");
  7.                     break;
  8.                 case "2":
  9.                     MessageBox.Show("2");
  10.                     break;
  11.                 case "3":
  12.                     MessageBox.Show("3");
  13.                     break;
  14.                 default:
  15.                     break;
  16.             }
  17.         }
复制代码
回复 使用道具 举报
wjjw
中级会员   /  发表于:2012-8-31 08:18:00
6#
非常感谢。 能否在提供button型的事件代码
回复 使用道具 举报
wjjw
中级会员   /  发表于:2012-8-31 09:38:00
7#
为什么 FarPoint.Win.Spread.CellType.ButtonCellType  没用 click事件啊
回复 使用道具 举报
ZenosZeng讲师达人认证 悬赏达人认证
超级版主   /  发表于:2012-8-31 09:56:00
8#
点击 ButtonCellType 之后会触发Spread的 ButtonClicked 事件。
回复 使用道具 举报
wjjw
中级会员   /  发表于:2012-8-31 11:13:00
9#
dof你好  你说的我没用弄明白
我想知道怎样 写入 button click事件
如图  
未命名.jpg (11.94 KB, 下载次数: 278)
回复 使用道具 举报
wjjw
中级会员   /  发表于:2012-8-31 14:13:00
10#
问题解决
  可以通过fpspread的buttonclicked事件解决。
但若有多个button事件,如何进行控制?
回复 使用道具 举报
12下一页
您需要登录后才可以回帖 登录 | 立即注册
返回顶部