当前位置:网站首页>DevExpress的双击获取单元格数据
DevExpress的双击获取单元格数据
2022-06-29 09:26:00 【zlbcdn】
1、设置 GirdViewt.OptionsBehavior.Editable = false;
设定变量 DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hInfo = new DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo(); //获取“撞击点”的位置
2、注册GridView的鼠标单击及GridView的双击事件
this.gridView.MouseDown += new MouseEventHandler(gridView_MouseDown); //用于获取GridHitInfo-撞击点的信息
this.gridView.DoubleClick += new EventHandler(gridView_DoubleClick);//双击事件
3、代码
//鼠标单击事件
//获取鼠标点击的位置
void gridView_InpatientPatient_MouseDown(object sender, MouseEventArgs e)
{
hInfo = gridView_InpatientPatient.CalcHitInfo(e.X, e.Y);
}
//界面双击的事件
//双击事件
void gridView_DoubleClick(object sender, EventArgs e)
{
//获取点
if (gridView.FocusedRowHandle < 0) return;
try
{
//双击某一单元格,执行代码
if (hInfo.InRowCell)
{
//获取
int rowid = this.gridView.FocusedRowHandle;
string selectedStr = this.gridView.GetRowCellValue(rowid, "PatientID").ToString();
MessageBox.Show(selectedStr);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
边栏推荐
猜你喜欢

单片机集成开发环境Keil5的使用

Simulation problem of two stacks

Binding mechanism of JVM methods

Six dimensional space BFS

Use of Azkaban in task scheduler

Application of keil5 integrated development environment for single chip microcomputer

SeaweedFS安全配置(Security Configuration)

Using rancher to build kubernetes cluster

520 钻石争霸赛 2021

2021年团体程序设计天梯赛-模拟赛
随机推荐
Ural1517 freedom of choice [suffix array: longest common continuous substring]
蛇形填数
L2-025 divide and rule (25 points)
qgis制图
2019-11-10 training summary
JVM instructions for four call methods
2019.11.17训练总结
HDU 4578 transformation (segment tree + skillful lazy tag placement)
逆向思维-小故事
2019.10.23训练总结
Is flush stock trading software reliable and safe?
这个开源项目超哇塞,手写照片在线生成
指针数组、数组指针和传参的相关问题
Six dimensional space BFS
Codeforces Round #645 (Div. 2)
nacos注册中心集群
Listview of the basic component of the shutter
Dsolve function of sympy
HDU 6778 car (group enumeration -- > shape pressure DP)
This open source project is super wow, and handwritten photos are generated Online