<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp_by_API%2FSystem.Windows.Forms%2FKeyEventArgs</id>
		<title>Csharp/C Sharp by API/System.Windows.Forms/KeyEventArgs - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp_by_API%2FSystem.Windows.Forms%2FKeyEventArgs"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp_by_API/System.Windows.Forms/KeyEventArgs&amp;action=history"/>
		<updated>2026-04-30T09:59:41Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp_by_API/System.Windows.Forms/KeyEventArgs&amp;diff=4222&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp_by_API/System.Windows.Forms/KeyEventArgs&amp;diff=4222&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:35Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 15:31, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp_by_API/System.Windows.Forms/KeyEventArgs&amp;diff=4223&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp_by_API/System.Windows.Forms/KeyEventArgs&amp;diff=4223&amp;oldid=prev"/>
				<updated>2010-05-26T12:10:09Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==KeyEventArgs.Alt==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
&lt;br /&gt;
   using System;&lt;br /&gt;
   using System.Drawing;&lt;br /&gt;
   using System.Collections;&lt;br /&gt;
   using System.ruponentModel;&lt;br /&gt;
   using System.Windows.Forms;&lt;br /&gt;
   using System.Data;&lt;br /&gt;
   public class KeyDemo : System.Windows.Forms.Form&lt;br /&gt;
   {&lt;br /&gt;
      private System.Windows.Forms.Label charLabel;&lt;br /&gt;
      private System.Windows.Forms.Label keyInfoLabel;&lt;br /&gt;
      public KeyDemo()&lt;br /&gt;
      {&lt;br /&gt;
         InitializeComponent();&lt;br /&gt;
      }&lt;br /&gt;
      private void InitializeComponent()&lt;br /&gt;
      {&lt;br /&gt;
         this.charLabel = new System.Windows.Forms.Label();&lt;br /&gt;
         this.keyInfoLabel = new System.Windows.Forms.Label();&lt;br /&gt;
         this.SuspendLayout();&lt;br /&gt;
         this.charLabel.Font = new System.Drawing.Font(&amp;quot;Microsoft Sans Serif&amp;quot;, 12F);&lt;br /&gt;
         this.charLabel.Location = new System.Drawing.Point(8, 8);&lt;br /&gt;
         this.charLabel.Name = &amp;quot;charLabel&amp;quot;;&lt;br /&gt;
         this.charLabel.Size = new System.Drawing.Size(168, 32);&lt;br /&gt;
         this.charLabel.TabIndex = 0;&lt;br /&gt;
         this.keyInfoLabel.Font = new System.Drawing.Font(&amp;quot;Microsoft Sans Serif&amp;quot;, 12F);&lt;br /&gt;
         this.keyInfoLabel.Location = new System.Drawing.Point(8, 56);&lt;br /&gt;
         this.keyInfoLabel.Name = &amp;quot;keyInfoLabel&amp;quot;;&lt;br /&gt;
         this.keyInfoLabel.Size = new System.Drawing.Size(168, 136);&lt;br /&gt;
         this.keyInfoLabel.TabIndex = 0;&lt;br /&gt;
         this.AutoScaleBaseSize = new System.Drawing.Size(15, 37);&lt;br /&gt;
         this.ClientSize = new System.Drawing.Size(184, 197);&lt;br /&gt;
         this.Controls.AddRange(new System.Windows.Forms.Control[] {this.keyInfoLabel,this.charLabel});&lt;br /&gt;
         this.Font = new System.Drawing.Font(&amp;quot;Microsoft Sans Serif&amp;quot;, 24F);&lt;br /&gt;
         this.Name = &amp;quot;Key Demo&amp;quot;;&lt;br /&gt;
         this.Text = &amp;quot;Key Demo&amp;quot;;&lt;br /&gt;
         this.KeyDown +=new System.Windows.Forms.KeyEventHandler(this.KeyDemo_KeyDown );&lt;br /&gt;
         this.KeyPress +=new System.Windows.Forms.KeyPressEventHandler(this.KeyDemo_KeyPress );&lt;br /&gt;
         this.KeyUp +=new System.Windows.Forms.KeyEventHandler(this.KeyDemo_KeyUp );&lt;br /&gt;
         &lt;br /&gt;
         this.ResumeLayout(false);&lt;br /&gt;
      }&lt;br /&gt;
      [STAThread]&lt;br /&gt;
      static void Main() &lt;br /&gt;
      {&lt;br /&gt;
         Application.Run( new KeyDemo() );&lt;br /&gt;
      }&lt;br /&gt;
      protected void KeyDemo_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e )&lt;br /&gt;
      {  &lt;br /&gt;
         charLabel.Text = &amp;quot;Key pressed: &amp;quot; + e.KeyChar;&lt;br /&gt;
      }&lt;br /&gt;
      private void KeyDemo_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e )&lt;br /&gt;
      {&lt;br /&gt;
         keyInfoLabel.Text = &lt;br /&gt;
            &amp;quot;Alt: &amp;quot; + (e.Alt ? &amp;quot;Yes&amp;quot; : &amp;quot;No&amp;quot;) + &amp;quot;\n&amp;quot; +&lt;br /&gt;
            &amp;quot;Shift: &amp;quot; + (e.Shift ? &amp;quot;Yes&amp;quot; : &amp;quot;No&amp;quot; ) + &amp;quot;\n&amp;quot; +&lt;br /&gt;
            &amp;quot;Ctrl: &amp;quot; + (e.Control ? &amp;quot;Yes&amp;quot; : &amp;quot;No&amp;quot; ) + &amp;quot;\n&amp;quot; + &lt;br /&gt;
            &amp;quot;KeyCode: &amp;quot; + e.KeyCode + &amp;quot;\n&amp;quot; +&lt;br /&gt;
            &amp;quot;KeyData: &amp;quot; + e.KeyData + &amp;quot;\n&amp;quot; +&lt;br /&gt;
            &amp;quot;KeyValue: &amp;quot; + e.KeyValue;                               &lt;br /&gt;
      }&lt;br /&gt;
   &lt;br /&gt;
      private void KeyDemo_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e )&lt;br /&gt;
      {&lt;br /&gt;
        Console.WriteLine(&amp;quot;Key up&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
           &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==KeyEventArgs.KeyCode==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
   &lt;br /&gt;
class ExitOnX: Form&lt;br /&gt;
{&lt;br /&gt;
     public static void Main()&lt;br /&gt;
     {&lt;br /&gt;
          Application.Run(new ExitOnX());&lt;br /&gt;
     }&lt;br /&gt;
     public ExitOnX()&lt;br /&gt;
     {&lt;br /&gt;
          Text = &amp;quot;Exit on X&amp;quot;;&lt;br /&gt;
     }&lt;br /&gt;
     protected override void OnKeyDown(KeyEventArgs kea)&lt;br /&gt;
     {&lt;br /&gt;
          if (kea.KeyCode == Keys.X)&lt;br /&gt;
               Close();&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==KeyEventArgs.KeyData==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using System.Runtime.InteropServices;&lt;br /&gt;
public class Form1 : Form&lt;br /&gt;
{&lt;br /&gt;
   [DllImport(&amp;quot;User32.dll&amp;quot;)]&lt;br /&gt;
   private static extern short GetAsyncKeyState( System.Windows.Forms.Keys vKey); &lt;br /&gt;
  private System.Windows.Forms.TextBox textBox1;&lt;br /&gt;
  private System.Windows.Forms.Label lbl;&lt;br /&gt;
  private System.Windows.Forms.Button cmdAsyncState;&lt;br /&gt;
  public Form1() {&lt;br /&gt;
        InitializeComponent();&lt;br /&gt;
  }&lt;br /&gt;
  private void Form1_KeyPress(object sender, KeyPressEventArgs e)&lt;br /&gt;
  {&lt;br /&gt;
    e.Handled = true;&lt;br /&gt;
  }&lt;br /&gt;
  private void Form1_KeyDown(object sender, KeyEventArgs e)&lt;br /&gt;
  {&lt;br /&gt;
    lbl.Text = &amp;quot;Key Down: &amp;quot; + e.KeyValue.ToString();&lt;br /&gt;
    lbl.Text += &amp;quot;\nKey Code: &amp;quot; + e.KeyCode.ToString();&lt;br /&gt;
    lbl.Text += &amp;quot;\nKey Data: &amp;quot; + e.KeyData.ToString();&lt;br /&gt;
    if ((e.Modifiers &amp;amp; Keys.Shift) == Keys.Shift)&lt;br /&gt;
    {&lt;br /&gt;
      lbl.Text += &amp;quot;\n&amp;quot; + &amp;quot;Shift was held down.&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    if ((e.Modifiers &amp;amp; Keys.Control) == Keys.Control)&lt;br /&gt;
    {&lt;br /&gt;
      lbl.Text += &amp;quot;\n&amp;quot; + &amp;quot;Control was held down.&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    if (e.Alt)&lt;br /&gt;
    {&lt;br /&gt;
      lbl.Text += &amp;quot;\n&amp;quot; + &amp;quot;Alt was held down.&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  private void cmdAsyncState_Click(object sender, EventArgs e)&lt;br /&gt;
  {&lt;br /&gt;
    int state = Convert.ToInt32(GetAsyncKeyState(Keys.A).ToString());&lt;br /&gt;
    switch (state)&lt;br /&gt;
    {&lt;br /&gt;
      case 0:&lt;br /&gt;
        lbl.Text = &amp;quot;A has not been pressed since the last call.&amp;quot;;&lt;br /&gt;
        break;&lt;br /&gt;
      case 1:&lt;br /&gt;
        lbl.Text = &amp;quot;A is not currently pressed, but has been pressed since the last call.&amp;quot;;&lt;br /&gt;
          break;&lt;br /&gt;
      case -32767:&lt;br /&gt;
        lbl.Text = &amp;quot;A is currently pressed.&amp;quot;;&lt;br /&gt;
        break;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  private void InitializeComponent()&lt;br /&gt;
  {&lt;br /&gt;
    this.textBox1 = new System.Windows.Forms.TextBox();&lt;br /&gt;
    this.lbl = new System.Windows.Forms.Label();&lt;br /&gt;
    this.cmdAsyncState = new System.Windows.Forms.Button();&lt;br /&gt;
    this.SuspendLayout();&lt;br /&gt;
    // &lt;br /&gt;
    // textBox1&lt;br /&gt;
    // &lt;br /&gt;
    this.textBox1.Location = new System.Drawing.Point(36, 36);&lt;br /&gt;
    this.textBox1.Name = &amp;quot;textBox1&amp;quot;;&lt;br /&gt;
    this.textBox1.Size = new System.Drawing.Size(205, 21);&lt;br /&gt;
    this.textBox1.TabIndex = 0;&lt;br /&gt;
    this.textBox1.Text = &amp;quot;&amp;amp;lt;Text will never appear here&amp;gt;&amp;quot;;&lt;br /&gt;
    // &lt;br /&gt;
    // lbl&lt;br /&gt;
    // &lt;br /&gt;
    this.lbl.AutoSize = true;&lt;br /&gt;
    this.lbl.Location = new System.Drawing.Point(35, 77);&lt;br /&gt;
    this.lbl.Name = &amp;quot;lbl&amp;quot;;&lt;br /&gt;
    this.lbl.Size = new System.Drawing.Size(0, 0);&lt;br /&gt;
    this.lbl.TabIndex = 1;&lt;br /&gt;
    // &lt;br /&gt;
    // cmdAsyncState&lt;br /&gt;
    // &lt;br /&gt;
    this.cmdAsyncState.Location = new System.Drawing.Point(36, 202);&lt;br /&gt;
    this.cmdAsyncState.Name = &amp;quot;cmdAsyncState&amp;quot;;&lt;br /&gt;
    this.cmdAsyncState.Size = new System.Drawing.Size(141, 24);&lt;br /&gt;
    this.cmdAsyncState.TabIndex = 2;&lt;br /&gt;
    this.cmdAsyncState.Text = &amp;quot;GetAsyncState() for \&amp;quot;A\&amp;quot;&amp;quot;;&lt;br /&gt;
    this.cmdAsyncState.Click += new System.EventHandler(this.cmdAsyncState_Click);&lt;br /&gt;
    // &lt;br /&gt;
    // Form1&lt;br /&gt;
    // &lt;br /&gt;
    this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);&lt;br /&gt;
    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;&lt;br /&gt;
    this.ClientSize = new System.Drawing.Size(292, 266);&lt;br /&gt;
    this.Controls.Add(this.cmdAsyncState);&lt;br /&gt;
    this.Controls.Add(this.lbl);&lt;br /&gt;
    this.Controls.Add(this.textBox1);&lt;br /&gt;
    this.Font = new System.Drawing.Font(&amp;quot;Tahoma&amp;quot;, 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));&lt;br /&gt;
    this.KeyPreview = true;&lt;br /&gt;
    this.Name = &amp;quot;Form1&amp;quot;;&lt;br /&gt;
    this.Text = &amp;quot;KeyTest&amp;quot;;&lt;br /&gt;
    this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Form1_KeyPress);&lt;br /&gt;
    this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);&lt;br /&gt;
    this.ResumeLayout(false);&lt;br /&gt;
    this.PerformLayout();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  [STAThread]&lt;br /&gt;
  static void Main()&lt;br /&gt;
  {&lt;br /&gt;
    Application.EnableVisualStyles();&lt;br /&gt;
    Application.Run(new Form1());&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==KeyEventArgs.KeyValue==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using System.Runtime.InteropServices;&lt;br /&gt;
public class Form1 : Form&lt;br /&gt;
{&lt;br /&gt;
   [DllImport(&amp;quot;User32.dll&amp;quot;)]&lt;br /&gt;
   private static extern short GetAsyncKeyState( System.Windows.Forms.Keys vKey); &lt;br /&gt;
  private System.Windows.Forms.TextBox textBox1;&lt;br /&gt;
  private System.Windows.Forms.Label lbl;&lt;br /&gt;
  private System.Windows.Forms.Button cmdAsyncState;&lt;br /&gt;
  public Form1() {&lt;br /&gt;
        InitializeComponent();&lt;br /&gt;
  }&lt;br /&gt;
  private void Form1_KeyPress(object sender, KeyPressEventArgs e)&lt;br /&gt;
  {&lt;br /&gt;
    e.Handled = true;&lt;br /&gt;
  }&lt;br /&gt;
  private void Form1_KeyDown(object sender, KeyEventArgs e)&lt;br /&gt;
  {&lt;br /&gt;
    lbl.Text = &amp;quot;Key Down: &amp;quot; + e.KeyValue.ToString();&lt;br /&gt;
    lbl.Text += &amp;quot;\nKey Code: &amp;quot; + e.KeyCode.ToString();&lt;br /&gt;
    lbl.Text += &amp;quot;\nKey Data: &amp;quot; + e.KeyData.ToString();&lt;br /&gt;
    if ((e.Modifiers &amp;amp; Keys.Shift) == Keys.Shift)&lt;br /&gt;
    {&lt;br /&gt;
      lbl.Text += &amp;quot;\n&amp;quot; + &amp;quot;Shift was held down.&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    if ((e.Modifiers &amp;amp; Keys.Control) == Keys.Control)&lt;br /&gt;
    {&lt;br /&gt;
      lbl.Text += &amp;quot;\n&amp;quot; + &amp;quot;Control was held down.&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    if (e.Alt)&lt;br /&gt;
    {&lt;br /&gt;
      lbl.Text += &amp;quot;\n&amp;quot; + &amp;quot;Alt was held down.&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  private void cmdAsyncState_Click(object sender, EventArgs e)&lt;br /&gt;
  {&lt;br /&gt;
    int state = Convert.ToInt32(GetAsyncKeyState(Keys.A).ToString());&lt;br /&gt;
    switch (state)&lt;br /&gt;
    {&lt;br /&gt;
      case 0:&lt;br /&gt;
        lbl.Text = &amp;quot;A has not been pressed since the last call.&amp;quot;;&lt;br /&gt;
        break;&lt;br /&gt;
      case 1:&lt;br /&gt;
        lbl.Text = &amp;quot;A is not currently pressed, but has been pressed since the last call.&amp;quot;;&lt;br /&gt;
          break;&lt;br /&gt;
      case -32767:&lt;br /&gt;
        lbl.Text = &amp;quot;A is currently pressed.&amp;quot;;&lt;br /&gt;
        break;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  private void InitializeComponent()&lt;br /&gt;
  {&lt;br /&gt;
    this.textBox1 = new System.Windows.Forms.TextBox();&lt;br /&gt;
    this.lbl = new System.Windows.Forms.Label();&lt;br /&gt;
    this.cmdAsyncState = new System.Windows.Forms.Button();&lt;br /&gt;
    this.SuspendLayout();&lt;br /&gt;
    // &lt;br /&gt;
    // textBox1&lt;br /&gt;
    // &lt;br /&gt;
    this.textBox1.Location = new System.Drawing.Point(36, 36);&lt;br /&gt;
    this.textBox1.Name = &amp;quot;textBox1&amp;quot;;&lt;br /&gt;
    this.textBox1.Size = new System.Drawing.Size(205, 21);&lt;br /&gt;
    this.textBox1.TabIndex = 0;&lt;br /&gt;
    this.textBox1.Text = &amp;quot;Text will never appear here&amp;quot;;&lt;br /&gt;
    // &lt;br /&gt;
    // lbl&lt;br /&gt;
    // &lt;br /&gt;
    this.lbl.AutoSize = true;&lt;br /&gt;
    this.lbl.Location = new System.Drawing.Point(35, 77);&lt;br /&gt;
    this.lbl.Name = &amp;quot;lbl&amp;quot;;&lt;br /&gt;
    this.lbl.Size = new System.Drawing.Size(0, 0);&lt;br /&gt;
    this.lbl.TabIndex = 1;&lt;br /&gt;
    // &lt;br /&gt;
    // cmdAsyncState&lt;br /&gt;
    // &lt;br /&gt;
    this.cmdAsyncState.Location = new System.Drawing.Point(36, 202);&lt;br /&gt;
    this.cmdAsyncState.Name = &amp;quot;cmdAsyncState&amp;quot;;&lt;br /&gt;
    this.cmdAsyncState.Size = new System.Drawing.Size(141, 24);&lt;br /&gt;
    this.cmdAsyncState.TabIndex = 2;&lt;br /&gt;
    this.cmdAsyncState.Text = &amp;quot;GetAsyncState() for \&amp;quot;A\&amp;quot;&amp;quot;;&lt;br /&gt;
    this.cmdAsyncState.Click += new System.EventHandler(this.cmdAsyncState_Click);&lt;br /&gt;
    // &lt;br /&gt;
    // Form1&lt;br /&gt;
    // &lt;br /&gt;
    this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);&lt;br /&gt;
    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;&lt;br /&gt;
    this.ClientSize = new System.Drawing.Size(292, 266);&lt;br /&gt;
    this.Controls.Add(this.cmdAsyncState);&lt;br /&gt;
    this.Controls.Add(this.lbl);&lt;br /&gt;
    this.Controls.Add(this.textBox1);&lt;br /&gt;
    this.Font = new System.Drawing.Font(&amp;quot;Tahoma&amp;quot;, 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));&lt;br /&gt;
    this.KeyPreview = true;&lt;br /&gt;
    this.Name = &amp;quot;Form1&amp;quot;;&lt;br /&gt;
    this.Text = &amp;quot;KeyTest&amp;quot;;&lt;br /&gt;
    this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Form1_KeyPress);&lt;br /&gt;
    this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);&lt;br /&gt;
    this.ResumeLayout(false);&lt;br /&gt;
    this.PerformLayout();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  [STAThread]&lt;br /&gt;
  static void Main()&lt;br /&gt;
  {&lt;br /&gt;
    Application.EnableVisualStyles();&lt;br /&gt;
    Application.Run(new Form1());&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==KeyEventArgs.Modifiers==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using System.Runtime.InteropServices;&lt;br /&gt;
public class Form1 : Form&lt;br /&gt;
{&lt;br /&gt;
   [DllImport(&amp;quot;User32.dll&amp;quot;)]&lt;br /&gt;
   private static extern short GetAsyncKeyState( System.Windows.Forms.Keys vKey); &lt;br /&gt;
  private System.Windows.Forms.TextBox textBox1;&lt;br /&gt;
  private System.Windows.Forms.Label lbl;&lt;br /&gt;
  private System.Windows.Forms.Button cmdAsyncState;&lt;br /&gt;
  public Form1() {&lt;br /&gt;
        InitializeComponent();&lt;br /&gt;
  }&lt;br /&gt;
  private void Form1_KeyPress(object sender, KeyPressEventArgs e)&lt;br /&gt;
  {&lt;br /&gt;
    e.Handled = true;&lt;br /&gt;
  }&lt;br /&gt;
  private void Form1_KeyDown(object sender, KeyEventArgs e)&lt;br /&gt;
  {&lt;br /&gt;
    lbl.Text = &amp;quot;Key Down: &amp;quot; + e.KeyValue.ToString();&lt;br /&gt;
    lbl.Text += &amp;quot;\nKey Code: &amp;quot; + e.KeyCode.ToString();&lt;br /&gt;
    lbl.Text += &amp;quot;\nKey Data: &amp;quot; + e.KeyData.ToString();&lt;br /&gt;
    if ((e.Modifiers &amp;amp; Keys.Shift) == Keys.Shift)&lt;br /&gt;
    {&lt;br /&gt;
      lbl.Text += &amp;quot;\n&amp;quot; + &amp;quot;Shift was held down.&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    if ((e.Modifiers &amp;amp; Keys.Control) == Keys.Control)&lt;br /&gt;
    {&lt;br /&gt;
      lbl.Text += &amp;quot;\n&amp;quot; + &amp;quot;Control was held down.&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    if (e.Alt)&lt;br /&gt;
    {&lt;br /&gt;
      lbl.Text += &amp;quot;\n&amp;quot; + &amp;quot;Alt was held down.&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  private void cmdAsyncState_Click(object sender, EventArgs e)&lt;br /&gt;
  {&lt;br /&gt;
    int state = Convert.ToInt32(GetAsyncKeyState(Keys.A).ToString());&lt;br /&gt;
    switch (state)&lt;br /&gt;
    {&lt;br /&gt;
      case 0:&lt;br /&gt;
        lbl.Text = &amp;quot;A has not been pressed since the last call.&amp;quot;;&lt;br /&gt;
        break;&lt;br /&gt;
      case 1:&lt;br /&gt;
        lbl.Text = &amp;quot;A is not currently pressed, but has been pressed since the last call.&amp;quot;;&lt;br /&gt;
          break;&lt;br /&gt;
      case -32767:&lt;br /&gt;
        lbl.Text = &amp;quot;A is currently pressed.&amp;quot;;&lt;br /&gt;
        break;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  private void InitializeComponent()&lt;br /&gt;
  {&lt;br /&gt;
    this.textBox1 = new System.Windows.Forms.TextBox();&lt;br /&gt;
    this.lbl = new System.Windows.Forms.Label();&lt;br /&gt;
    this.cmdAsyncState = new System.Windows.Forms.Button();&lt;br /&gt;
    this.SuspendLayout();&lt;br /&gt;
    // &lt;br /&gt;
    // textBox1&lt;br /&gt;
    // &lt;br /&gt;
    this.textBox1.Location = new System.Drawing.Point(36, 36);&lt;br /&gt;
    this.textBox1.Name = &amp;quot;textBox1&amp;quot;;&lt;br /&gt;
    this.textBox1.Size = new System.Drawing.Size(205, 21);&lt;br /&gt;
    this.textBox1.TabIndex = 0;&lt;br /&gt;
    this.textBox1.Text = &amp;quot;&amp;amp;lt;Text will never appear here&amp;gt;&amp;quot;;&lt;br /&gt;
    // &lt;br /&gt;
    // lbl&lt;br /&gt;
    // &lt;br /&gt;
    this.lbl.AutoSize = true;&lt;br /&gt;
    this.lbl.Location = new System.Drawing.Point(35, 77);&lt;br /&gt;
    this.lbl.Name = &amp;quot;lbl&amp;quot;;&lt;br /&gt;
    this.lbl.Size = new System.Drawing.Size(0, 0);&lt;br /&gt;
    this.lbl.TabIndex = 1;&lt;br /&gt;
    // &lt;br /&gt;
    // cmdAsyncState&lt;br /&gt;
    // &lt;br /&gt;
    this.cmdAsyncState.Location = new System.Drawing.Point(36, 202);&lt;br /&gt;
    this.cmdAsyncState.Name = &amp;quot;cmdAsyncState&amp;quot;;&lt;br /&gt;
    this.cmdAsyncState.Size = new System.Drawing.Size(141, 24);&lt;br /&gt;
    this.cmdAsyncState.TabIndex = 2;&lt;br /&gt;
    this.cmdAsyncState.Text = &amp;quot;GetAsyncState() for \&amp;quot;A\&amp;quot;&amp;quot;;&lt;br /&gt;
    this.cmdAsyncState.Click += new System.EventHandler(this.cmdAsyncState_Click);&lt;br /&gt;
    // &lt;br /&gt;
    // Form1&lt;br /&gt;
    // &lt;br /&gt;
    this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);&lt;br /&gt;
    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;&lt;br /&gt;
    this.ClientSize = new System.Drawing.Size(292, 266);&lt;br /&gt;
    this.Controls.Add(this.cmdAsyncState);&lt;br /&gt;
    this.Controls.Add(this.lbl);&lt;br /&gt;
    this.Controls.Add(this.textBox1);&lt;br /&gt;
    this.Font = new System.Drawing.Font(&amp;quot;Tahoma&amp;quot;, 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));&lt;br /&gt;
    this.KeyPreview = true;&lt;br /&gt;
    this.Name = &amp;quot;Form1&amp;quot;;&lt;br /&gt;
    this.Text = &amp;quot;KeyTest&amp;quot;;&lt;br /&gt;
    this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Form1_KeyPress);&lt;br /&gt;
    this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);&lt;br /&gt;
    this.ResumeLayout(false);&lt;br /&gt;
    this.PerformLayout();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  [STAThread]&lt;br /&gt;
  static void Main()&lt;br /&gt;
  {&lt;br /&gt;
    Application.EnableVisualStyles();&lt;br /&gt;
    Application.Run(new Form1());&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>