找回密码
 立即注册

QQ登录

只需一步,快速开始

zheng19271927

高级会员

2

主题

12

帖子

1134

积分

高级会员

积分
1134

活字格认证

最新发帖
zheng19271927
高级会员   /  发表于:2012-3-5 10:27  /   查看:10291  /  回复:12
如题。就是比如第一个单元格我要输入4个字符。我再输入每个字符之后,要进行判断,如果 已经四个字符了。。就fxg.col = fxg.col+1(类似的功能都可以只要是光标跳到下个单元格就可以了。。)
怎么实现 求帮助。  
还个问题是  。为什么 textchange 事件没有触发呢?这个事件是怎么触发的?

12 个回复

倒序浏览
iceman
社区贡献组   /  发表于:2012-3-5 12:30:00
沙发

回复 1# zheng19271927 的帖子

zheng19271927 你好,请尝试以下代码:
  1.         private void c1FlexGrid1_KeyDownEdit(object sender, C1.Win.C1FlexGrid.KeyEditEventArgs e)
  2.         {
  3.             int row = e.Row;
  4.             int col = e.Col;
  5.             string test = this.c1FlexGrid1.Editor.Text;
  6.             if (test.Length==4)
  7.             {
  8.                 this.c1FlexGrid1.Col += 1;
  9.             }
  10.         }
复制代码
回复 使用道具 举报
zheng19271927
高级会员   /  发表于:2012-3-5 12:34:00
板凳

回复 2# iceman 的帖子

你好。这种方法 我试过的。。他出现的问题是当前按下的字符 不会显示出来的。keypressedit  也是一样
补:如果手动它给赋值的话。出现的问题是 光标位置不知道。新加的字符不知道 添加到哪个字符之后
补2 : 我要的效果是在按下第4个字符的时候,单元格赋好值,直接进入到下个单元格。不需要多安一个字符。   例:我要在[单元格1]输入1234,在我按下4 的时候(或者之后) 光标跳到[单元格2],[单元格1]里的值是1234
我的环境是 visual studio 2008  vb.net ,c1flexgrid 版本2.6.20092.412(日本语版)
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-3-5 15:12:00
地板

回复 3# zheng19271927 的帖子

zheng19271927 你好,可以使用 KeyUpEdit 事件实现:
  1.         private void c1FlexGrid1_KeyUpEdit(object sender, C1.Win.C1FlexGrid.KeyEditEventArgs e)
  2.         {
  3.             int row = e.Row;
  4.             int col = e.Col;
  5.             string test = this.c1FlexGrid1.Editor.Text;
  6.             if (test.Length == 4)
  7.             {
  8.                 this.c1FlexGrid1.Col += 1;
  9.             }
  10.         }
复制代码
回复 使用道具 举报
zheng19271927
高级会员   /  发表于:2012-3-5 17:45:00
5#

回复 4# iceman 的帖子

谢谢……问题已经解决了。 这是公司的解决方案。留着给自己回家了看。=,=还没给测试人员测过不知道对不……

  1. If e.Col = CST_COL_社内品名コード左 And e.KeyChar <> vbBack And e.KeyChar <> "." Then
  2.                                 Dim selectLenth As Integer = DirectCast(fxg.Editor, TextBox).SelectionLength
  3.                                 If GetByteCount(fxg.Editor.Text) + GetByteCount(e.KeyChar) - selectLenth >= 4 Then

  4.                                     Dim startIndex As Integer = DirectCast(fxg.Editor, TextBox).SelectionStart
  5.                                     Dim leftStr As String = DirectCast(fxg.Editor, TextBox).Text.Substring(0, startIndex)
  6.                                     Dim rightStr As String = DirectCast(fxg.Editor, TextBox).Text.Substring(startIndex)
  7.                                     If (leftStr &amp; e.KeyChar &amp; rightStr).Length > DirectCast(fxg.Editor, TextBox).MaxLength Then
  8.                                         e.Handled = True
  9.                                         Return
  10.                                     End If
  11.                                     fxg.Editor.Text = leftStr &amp; e.KeyChar &amp; rightStr
  12.                                     fxg.FinishEditing()
  13.                                     fxg.Col = fxg.Col + 1
  14.                                     fxg.StartEditing()
  15.                                     e.Handled = True
  16.                                     Return

  17.                                 End If
  18.                             End If
复制代码
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-3-5 17:46:00
6#

回复 5# zheng19271927 的帖子

:-D
回复 使用道具 举报
zheng19271927
高级会员   /  发表于:2012-3-5 17:48:00
7#

回复 4# iceman 的帖子

对了…… 为什么 textchange 事件没有触发呢?这个事件是怎么触发的? 我在帮助文档里找不到这个事件的。
但是在控件的事件里却能找到的
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-3-5 17:52:00
8#

回复 7# zheng19271927 的帖子

zheng19271927 你好,这个问题目前在调查中,明天回复。
回复 使用道具 举报
zheng19271927
高级会员   /  发表于:2012-3-7 20:36:00
9#

回复 8# iceman 的帖子

哥哥 你没回我。=,=
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-3-7 22:01:00
10#

回复 9# zheng19271927 的帖子

zheng19271927 你好,
不好意思,这个问题正在调查当中。有结果我会通知你。
回复 使用道具 举报
12下一页
您需要登录后才可以回帖 登录 | 立即注册
返回顶部