2009-05-26 9 views

Respuesta

21

El evento ItemCheck se activa cuando el estado de activación de un elemento está a punto de cambiar, que le permite examinar el valor antiguo y nuevo, y para cancelar el cambio si lo desea (asignando la propiedad NewValue de los EventArgs parámetro). ItemChecked se activa después de que se complete el control (o desmarque).

Ejemplo de código:

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 
} 
Cuestiones relacionadas