Objectlistview双击解释
Objectlistview doubleclick explained
我正在尝试在 objectlistview
对象中实现 doubleclick
函数。
根据开发人员的说法,应该使用 ItemActivate
而不是 MouseDoubleClick
。
所以我想到了这个:
private void treeListView_ItemActivate(object sender, EventArgs e)
{
try
{
ListView.SelectedIndexCollection col = treeListView.SelectedIndices;
MessageBox.Show(col[0].ToString());
}
catch (Exception e3)
{
globals.logfile.error(e3.ToString());
globals.logfile.flush();
}
finally
{
}
}
它为每个双击的行提供一个值。
但是我如何从该行中获取详细信息?
这是我现在使用的完整解决方案:
private void treeListView_ItemActivate(object sender, EventArgs e)
{
try
{
var se = (StructureElement)treeListView.GetItem(treeListView.SelectedIndex).RowObject;
MessageBox.Show(se.id.ToString());
}
catch (Exception e3)
{
globals.logfile.error(e3.ToString());
globals.logfile.flush();
}
finally
{
}
}
Which comes up with a value for each double clicked row. But how do I get the details from that row?
我认为您必须像这样使用底层 OLVListItem
访问 RowObject
:
private void treeListView_ItemActivate(object sender, EventArgs e) {
var item = treeListView.GetItem(treeListView.SelectedIndex).RowObject;
}
这就是我现在从树列表视图中获取数据的方式:
private void treeListView_ItemActivate(object sender, EventArgs e)
{
try
{
var se = (StructureElement)treeListView.GetItem(treeListView.SelectedIndex).RowObject;
MessageBox.Show(se.id.ToString());
}
catch (Exception e3)
{
globals.logfile.error(e3.ToString());
globals.logfile.flush();
}
finally
{
}
}
我正在尝试在 objectlistview
对象中实现 doubleclick
函数。
根据开发人员的说法,应该使用 ItemActivate
而不是 MouseDoubleClick
。
所以我想到了这个:
private void treeListView_ItemActivate(object sender, EventArgs e)
{
try
{
ListView.SelectedIndexCollection col = treeListView.SelectedIndices;
MessageBox.Show(col[0].ToString());
}
catch (Exception e3)
{
globals.logfile.error(e3.ToString());
globals.logfile.flush();
}
finally
{
}
}
它为每个双击的行提供一个值。 但是我如何从该行中获取详细信息?
这是我现在使用的完整解决方案:
private void treeListView_ItemActivate(object sender, EventArgs e)
{
try
{
var se = (StructureElement)treeListView.GetItem(treeListView.SelectedIndex).RowObject;
MessageBox.Show(se.id.ToString());
}
catch (Exception e3)
{
globals.logfile.error(e3.ToString());
globals.logfile.flush();
}
finally
{
}
}
Which comes up with a value for each double clicked row. But how do I get the details from that row?
我认为您必须像这样使用底层 OLVListItem
访问 RowObject
:
private void treeListView_ItemActivate(object sender, EventArgs e) {
var item = treeListView.GetItem(treeListView.SelectedIndex).RowObject;
}
这就是我现在从树列表视图中获取数据的方式:
private void treeListView_ItemActivate(object sender, EventArgs e)
{
try
{
var se = (StructureElement)treeListView.GetItem(treeListView.SelectedIndex).RowObject;
MessageBox.Show(se.id.ToString());
}
catch (Exception e3)
{
globals.logfile.error(e3.ToString());
globals.logfile.flush();
}
finally
{
}
}