The following code example hides a button when the CTRL key is pressed while the button is clicked. This example requires that you have a Button named button1 on a Form.
private:
void button1_Click( Object^ sender, System::EventArgs^ /*e*/ )
{
/* If the CTRL key is pressed when the
* control is clicked, hide the control. */if ( Control::ModifierKeys == Keys::Control )
{
(dynamic_cast<Control^>(sender))->Hide();
}
}