KeyEventArgs

KeyEventArgs

System. Windows .Forms (system. windows .forms.dll) class

This encapsulates the data for Control.KeyDown and Control.KeyUp events. Unlike the Control.KeyPress event, you can retrieve raw, unprocessed key data for the event.

You can retrieve the state of the modifier keys through the Alt , Control , and Shift properties. The actual KeyCode can be retrieved, which can be directly compared for equality with an entry in the Keys enumeration. The KeyData is similar, but also includes the modifier key status in the upper 4 bits, so you should compare using the & operator. You can also retrieve the KeyValue , which is an integer representation of the KeyData (i.e., the raw value that came from the OS). Finally, you can retrieve the Modifiers only.

If you do not wish to process the event further, you can set the Handled property to true.

 public class  KeyEventArgs  : EventArgs {  // Public Constructors  public  KeyEventArgs  (Keys  keyData  );  // Public Instance Properties  public virtual bool  Alt  {get; }    public bool  Control  {get; }    public bool  Handled  {set; get; }    public Keys  KeyCode  {get; }    public Keys  KeyData  {get; }    public int  KeyValue  {get; }    public Keys  Modifiers  {get; }    public virtual bool  Shift  {get; } } 

Hierarchy

System.Object System.EventArgs KeyEventArgs

Passed To

Control.{OnKeyDown() , OnKeyUp() , RaiseKeyEvent()} , DataGrid.ProcessGridKey() , KeyEventHandler.{BeginInvoke() , Invoke()} , UpDownBase.OnTextBoxKeyDown()



. Net Windows Forms in a Nutshell
.NET Windows Forms in a Nutshell
ISBN: 0596003382
EAN: 2147483647
Year: 2002
Pages: 794

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net