标签:dev gridcontrol gridview 光标 位置
前段时间遇到一个需求,在gridcontrol单元格中光标位置插入选择的特殊符号,按理说需求很简单,但是在开发过程中却遇到一个问题,无法获取光标在单元格中的位置,查遍了控件的帮助文档也没有找到现成的方法,最后通过BaseEdit折中转换了一下,算是解决了这个问题,现讲解决代码贴出来,给有需要的人提供帮助
private DevExpress.XtraEditors.BaseEdit m_gridViewActiveEditor = null; private void gridView1_ShownEditor(object sender, EventArgs e) { DevExpress.XtraGrid.Views.Grid.GridView grid = sender as DevExpress.XtraGrid.Views.Grid.GridView; m_gridViewActiveEditor = grid.ActiveEditor; m_gridViewActiveEditor.Click += new EventHandler(m_gridViewActiveEditor_Click); } void m_gridViewActiveEditor_Click(object sender, EventArgs e) { int nStart = (m_gridViewActiveEditor as DevExpress.XtraEditors.TextEdit).SelectionStart; lblSelectionStart.Text = nStart.ToString(); }
本文出自 “土豆土豆,我是地瓜” 博客,请务必保留此出处http://254698001.blog.51cto.com/2521548/1863992
标签:dev gridcontrol gridview 光标 位置
原文地址:http://254698001.blog.51cto.com/2521548/1863992