列表视图选择问题 [英] list view selection problem
本文介绍了列表视图选择问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对不起,我有一个树状结构图,并且有一些操作名称
例如:1位客户
2销售
3个产品
我单击Custumer操作并打开此表单.我正在处理此表单,然后关闭此表单.
再次,我要打开客户操作表格,然后再打开.如果要先打开此表格,则应单击销售操作,然后再次单击客户操作.
如何解决这个问题?
我的朋友说那里是代表财产,但我不知道.
sorry I have a treeview ıtem and has some operatıons name
for ex:1 Customer
2 Sale
3 Product
I click Custumer operatıon and this form open.I work on this form and I close this form.
Again I want to open customer operatıon form isnt open.if you want to open this form fırst you should click sale operatıon and then agaın you should clıck customer operatıon.
how can solve thıs problem?
my frıend said there ıs delegate property but ı dont know.
推荐答案
我可以想到两种方法:
1.禁用无法使用的节点或
2.在包含树视图的表单中跟踪上次打开的表单,如果用户打开了他不应该打开的表单,则显示一条消息.
There are two ways that I can think of:
1. Disabling the nodes which cannot be used or
2. Keeping track of last opened form in the form containing the tree view and if the user opens a form which he should not, display a message.
如果我错了,请告诉我,但是听起来您有ListView
.您单击一个ListViewItem
,它将打开一个表单.但是,如果要再次打开该表单,则必须先选择其他项.
我的猜测是您已经钩住了SelectedIndexChanged
事件.如果事实真是这样,那么该事件将仅选择更改时.这意味着,因为已经选择了客户",所以再次单击它不会更改选择.
代替使用SelectedIndexChanged
,而使用MouseClick
事件.然后,首先检查是否选中了一个项目,如果已选中,请打开它的窗体.
或者,在SelectedIndexChanged
事件处理程序的末尾,运行listView1.SelectedIndices.Clear();
.这样可以确保每次单击时都会触发SelectedIndexChanged
事件.这也不会为用户显示项目上的突出显示...听起来像您想要的那样.
您在使用SelectedIndexChanged
吗?
Tell me if I am wrong, but it sounds like you have aListView
. You click on oneListViewItem
and it opens up a form. But if you want to open that form again, you have to select a different item first.
My guess is that you have hooked theSelectedIndexChanged
event. If that''s the case, then the event will only fire when the selection changes. This means that because Customer is already selected, clicking it again doesn''t change the selection.
Instead of usingSelectedIndexChanged
, use theMouseClick
event. Then, first check to see if an item is selected, and if it is, open it''s form.
Or, at the end of theSelectedIndexChanged
event handler, runlistView1.SelectedIndices.Clear();
. This will ensure that everytime you go to click, theSelectedIndexChanged
event will fire. That will also not show the highlighting on an item for the user...which sounds like what you might want.
Are you usingSelectedIndexChanged
?
这篇关于列表视图选择问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文