DevExpress XtraGrid 行双击事件的处理
2012-03-30 18:13
190 查看
要响应GridView的单击或者双击事件,要设置GridView的OptionsBehavior.Editable=false。如果为true,它是不会响应这这两个事件的。 它本的的机制就是这样,祥细说明请看: The DoubleClick event occurs when the end user double-clicks within a view. The DoubleClick event does not occur if an in-place editor is activated as a result of double-clicking as well as when double-clicking within the GridControl.EmbeddedNavigator.
//双击行弹出nodeDetail信息 private void gridView1_MouseDown(object sender, MouseEventArgs e) { DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hInfo = gridView1.CalcHitInfo(new Point(e.X,e.Y)); if (e.Button == MouseButtons.Left && e.Clicks == 2) { //判断光标是否在行范围内 if (hInfo.InRow) { //取得选定行信息 string nodeName = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "nodeName").ToString(); //string nodeName = gridView1.GetRowCellValue(gridView1.GetSelectedRows()[0], "nodeName").ToString(); string sql = "select nodeDetail from treelist where nodeName = '" + nodeName + "'"; SqlCommand comm = new SqlCommand(sql, conn); try { conn.Open(); MessageBox.Show(comm.ExecuteScalar().ToString(), "Detail"); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } finally { conn.Close(); } } } }
相关文章推荐
- DevExpress XtraGrid 行双击事件的处理
- 安卓的双击事件处理
- Silverlight 鼠标双击事件处理
- 单击事件和双击事件同时存在的处理办法
- AWT/Swing中处理鼠标双击(多击)以及右键点击的事件处理办法
- Symbian触摸屏双击事件处理
- 博为峰Java技术文章 ——JavaSE Swing列表框双击事件的处理Ⅰ
- android 处理双击事件监听
- cocos2dx touch 单击、双击、三连击和长按事件处理
- Cocos2d-x处理双击事件的两种方法!
- 博为峰Java技术文章 ——JavaSE Swing列表框双击事件的处理Ⅱ
- 关于Winform ListBox的双击事件处理
- CListCtrl控件主要事件及LVN_ITEMCHANGED消息和鼠标双击列表项事件的处理
- swing处理双击和三击事件的方法
- android处理双击事件
- GXT grid 添加双击事件处理
- VS2010不能添加变量 双击不能添加处理事件 以及如何添加窗口系统事件
- Android 中如何处理双击事件
- 像QQ一样窗体最小化到隐藏区域中(含隐藏后双击打开及右击处理事件)
- java小程序中鼠标事件的响应处理(包含右键、双击等)