前段时间遇到一个需求,在gridcontrol单元格中光标位置插入选择的特殊符号,按理说需求很简单,但是在开发过程中却遇到一个问题,无法获取光标在单元格中的位置,查遍了控件的帮助文档也没有找到现成的方法,最后通过BaseEdit折中转换了一下,算是解决了这个问题,现讲解决代码贴出来,给有需要的人提供帮助

privateDevExpress.XtraEditors.BaseEditm_gridViewActiveEditor=null;privatevoidgridView1_ShownEditor(objectsender,EventArgse){DevExpress.XtraGrid.Views.Grid.GridViewgrid=senderasDevExpress.XtraGrid.Views.Grid.GridView;m_gridViewActiveEditor=grid.ActiveEditor;m_gridViewActiveEditor.Click+=newEventHandler(m_gridViewActiveEditor_Click);}voidm_gridViewActiveEditor_Click(objectsender,EventArgse){intnStart=(m_gridViewActiveEditorasDevExpress.XtraEditors.TextEdit).SelectionStart;lblSelectionStart.Text=nStart.ToString();}



附件:http://down.51cto.com/data/2368277