我有一个ListView
包含4个项目的项目,每个项目有3个子项目。
现在,例如,我想获得相Form
对于项目2子项目2的坐标(位置)。
我该怎么做?
您正在寻找的Bounds
属性ListViewSubItem
。这是该属性的简单用法:
private void listView1_MouseDown(object sender, MouseEventArgs e)
{
var bound = listView1.Items[1].SubItems[1].Bounds;
if (e.X > bound.Left && e.X < bound.Right && e.Y > bound.Top && e.Y < bound.Bottom)
{
MessageBox.Show("hello world");
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句