[转]当鼠标点击ListView下面的空白区域时,如何使ListView的原item选项仍然为选中状态
2008-11-27 18:03
363 查看
本文转自:http://topic.csdn.net/t/20051126/00/4419253.html
问:
楼主free_xixi(free_xixi)2005-11-26 00:40:55 在 .NET技术 / C# 提问
当鼠标点击listview下面的空白区域时,如何使listview 的原item选项仍然为选中状态
这样可使我不至于在其他控件操作时失去对象.
答:
6 楼MyLf(不睡觉的鱼)回复于 2005-12-07 12:10:46 得分 15在MouseUp中做:
private void listview_MouseUp(object sender, MouseEventArgs e)
{
if(this.listview.SelectedItems.Count == 0)
{
if(this.listview.FocusedItem != null)
{
ListViewItem item = this.listview.GetItemAt(e.X,e.Y);
if(item == null)
{ this.listview.FocusedItem.Selected = true;
}
}
}
}
不过,对于多选的情况,这个是不行了。
问:
楼主free_xixi(free_xixi)2005-11-26 00:40:55 在 .NET技术 / C# 提问
当鼠标点击listview下面的空白区域时,如何使listview 的原item选项仍然为选中状态
这样可使我不至于在其他控件操作时失去对象.
答:
6 楼MyLf(不睡觉的鱼)回复于 2005-12-07 12:10:46 得分 15在MouseUp中做:
private void listview_MouseUp(object sender, MouseEventArgs e)
{
if(this.listview.SelectedItems.Count == 0)
{
if(this.listview.FocusedItem != null)
{
ListViewItem item = this.listview.GetItemAt(e.X,e.Y);
if(item == null)
{ this.listview.FocusedItem.Selected = true;
}
}
}
}
不过,对于多选的情况,这个是不行了。
相关文章推荐
- [转]当鼠标点击ListView下面的空白区域时,如何使ListView的原item选项仍然为选中状态
- [转]当鼠标点击ListView下面的空白区域时,如何使ListView的原item选项仍然为选中状态
- ListView点击item改变背景,重新选中另一项刷新,默认是选中第一项的状态
- 如何记录Listview中item的点击状态
- 如何记录ListView滚动后CheckBox保持选中状态以及当全选后让滚动出来的item也被选中
- ListView控件的列表项的文字不满一行的时候,如何实现点击该列表项的空白区域仍可触发列表项的点击事件
- C# listview之点击空白区仍然不失去选中项的状态
- 点击CListCtrl空白后,原来选中的ITEM仍处于被选中状态
- 禁止ListView 的Item点击事件或选中事件
- 如何解决IE8中select控件多选控件在焦点不在控件上时点击选项要点击两次才能选中的问题
- 如何判断ListView中的CheckItem项是否选中?并将所以选项从ListView控件中删除?
- 如何让ListView的item不可点击
- 【转载】Listview可以选择多行,点击选中行item字体颜色变化
- android朋友圈监听键盘状态 点击空白区域隐藏键盘
- ListView中设置item点击状态的背景色
- android中如何去掉pulltorefreshlistview点击item时的背景颜色,与item外边距设置
- android 监听软键盘弹起和关闭状态与点击空白区域软键盘隐藏
- 如何让ListView的item不可点击
- ListView点击或选中item改变背景
- listview控件当点击进入一个item后返回,仍然返回到点击item时listview所定位到的位置