ListView.ItemCheck与ListView.ItemChecked在.NET [英] ListView.ItemCheck versus ListView.ItemChecked in .NET

查看:190
本文介绍了ListView.ItemCheck与ListView.ItemChecked在.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是,在ListView之间的差异<一href="http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.itemcheck.aspx">ItemCheck和ListView <一href="http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.itemchecked.aspx">ItemChecked在.NET事件?

What is the difference between the ListView.ItemCheck and ListView.ItemChecked events in .NET?

推荐答案

ItemCheck 事件被触发时,一个项目的选中状态的即将改变的,让你检查旧的和新的价值,如果你想(通过分配的EventArgs参数的NewValue属性)取消更改。 ItemChecked 被触发的的检查后(或取消)完成的。

The ItemCheck event is triggered when the checked state of an item is about to change, allowing you to examine the old and new value, and to cancel the change if you wish (by assigning the NewValue property of the eventargs parameter). ItemChecked is triggered after the check (or uncheck) is completed.

code样品:<​​/ P>

Code sample:

private void ListView_ItemCheck(object sender, ItemCheckEventArgs e)
{
    // the checked state of an item is about to change
    if (e.NewValue == CheckState.Checked)
    {
        // perform some check if this is allowed, and if not...
        e.NewValue = e.CurrentValue;
    }
}

private void ListView_ItemChecked(object sender, ItemCheckedEventArgs e)
{
    // the checked state of an item has changed
}

这篇关于ListView.ItemCheck与ListView.ItemChecked在.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆