For some reason, the first solution, translated into C++/CLI, will create a stack overflow if you shift- or control-click anywhere besides the "Name" column. MarqW's solution, translated into C++/CLI works fine. No need for global variables.
private: System::Void listView1_ItemCheck(System::Object^ sender, System::Windows::Forms::ItemCheckEventArgs^ e)
{
if( (ModifierKeys == Keys::Control) || (ModifierKeys == Keys::Shift) )
{
e->NewValue = e->CurrentValue;
}
}
It's the difference between the ItemCheck
and ItemChecked
events.
modified on Monday, August 23, 2010 3:30 PM