ListView.ItemCheck与.NET中的ListView.ItemChecked [英] ListView.ItemCheck versus ListView.ItemChecked in .NET

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

问题描述

ListView有什么区别? ItemCheck 和ListView。 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.

代码示例:

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与.NET中的ListView.ItemChecked的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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