找回密码
 立即注册

QQ登录

只需一步,快速开始

weizebin

论坛元老

9

主题

29

帖子

1万

积分

论坛元老

积分
10453

活字格认证

weizebin
论坛元老   /  发表于:2013-3-5 09:26  /   查看:5404  /  回复:5
我使用的是Spread for WinForms产品。
现在需要在在FpSpread控件中添加TextBox文本框并且还是可以实现自动补全的功能类似google查询的功能。在FpSpread能否实现该功能呢,需要如何才能实现。希望版主给予解决,在此万分感想了!

5 个回复

倒序浏览
ZenosZeng讲师达人认证 悬赏达人认证
超级版主   /  发表于:2013-3-5 11:42:00
沙发
请参考以下代码:
  1. AutoCompleteStringCollection acsc = new AutoCompleteStringCollection();
  2. acsc.AddRange(new string[]{"One", "Two", "Three", "Four"});
  3. FarPoint.Win.Spread.CellType.ComboBoxCellType cb = new FarPoint.Win.Spread.CellType.ComboBoxCellType();
  4. cb.Items = new string[]{"One", "Two", "Three", "Four"};
  5. cb.Editable = true;
  6. cb.AutoCompleteCustomSource = acsc;
  7. cb.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
  8. cb.AutoCompleteSource = AutoCompleteSource.CustomSource;
复制代码
回复 使用道具 举报
weizebin
论坛元老   /  发表于:2013-3-5 15:00:00
板凳
回复 2楼dof的帖子

很感谢您给的答复,能实现出效果了。但是现在他是有下拉框的样式的,我怎么能把那一个小三角去掉吗?并且对已经自动出来的数据直接用键盘的上下按键也能获取出该值呢?
回复 使用道具 举报
ZenosZeng讲师达人认证 悬赏达人认证
超级版主   /  发表于:2013-3-5 18:07:00
地板
如果不需要下拉箭头,可以使用TextCellType类型:
  1.     private void Form1_Load(object sender, EventArgs e)
  2.     {
  3.         AutoCompleteStringCollection acsc = new AutoCompleteStringCollection();
  4.         acsc.AddRange(new string[] { "One", "Two", "Three", "Four" });
  5.         FarPoint.Win.Spread.CellType.TextCellType cb = new FarPoint.Win.Spread.CellType.TextCellType();            
  6.         cb.AutoCompleteCustomSource = acsc;
  7.         cb.AutoCompleteMode = AutoCompleteMode.Suggest;
  8.         cb.AutoCompleteSource = AutoCompleteSource.CustomSource;
  9.             
  10.         fpSpread1.ActiveSheet.Columns[0].CellType = cb;
  11.     }
复制代码


现在还不支持上下键选择值的操作。
回复 使用道具 举报
weizebin
论坛元老   /  发表于:2013-3-5 18:14:00
5#
回复 4楼dof的帖子

哦,这样,谢谢版主了,
回复 使用道具 举报
ZenosZeng讲师达人认证 悬赏达人认证
超级版主   /  发表于:2013-3-5 18:17:00
6#
哈哈,不客气
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部