乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      C#檢測任意鍵的前任值

       空城66 2014-10-25

      創(chuàng)建C#工程并在其中創(chuàng)建KeyStatePanel 窗體如下:
      public class KeyStatePanel : StatusBarPanel
      {
          [DllImport("user32.dll")]
          private  static extern int  GetKeyState(int  nVirtKey);//獲得指定鍵當前狀態(tài)

          private const int VK_CAPITAL = 0×14;
          private const int VK_INSERT = 0×2D;
          private const int VK_NUMLOCK = 0×90;
          private const int VK_SCROLL = 0×91;

          public enum KeyStatePanelStyle : int
          {
              CapsLock = VK_CAPITAL,
              Insert = VK_INSERT,
              NumLock = VK_NUMLOCK,
              ScrollLock = VK_SCROLL
          }

          KeyStatePanelStyle _keyStatePanelStyle;

          public KeyStatePanelStyle KeyStyle
          {
              set
              {
                  _keyStatePanelStyle = value;

                  _keyState = GetKeyState((int) _keyStatePanelStyle);//狀態(tài)更新
                  UpdateText();//文本更新
              }
              get { return _keyStatePanelStyle; }
          }

          int _keyState = 0;

          public KeyStatePanel(KeyStatePanelStyle styl)
          {
              this.KeyStyle = styl;
              Application.Idle += new EventHandler(Application_Idle);//添加事件處理方法
          }


          private void Application_Idle(object sender, EventArgs e)
          {
              int keyState = GetKeyState((int) _keyStatePanelStyle);
              if (keyState != _keyState)
              {
                  _keyState = keyState;
                  UpdateText();
              }
          }


          private void UpdateText()
          {//根據(jù)當前鍵值狀態(tài)更新窗體狀態(tài)欄文本
              if (_keyState != 0)
              {
                  switch (_keyStatePanelStyle)
                  {
                      case KeyStatePanelStyle.CapsLock:
                          this.Text = "CAPS";
                          break;
                      case KeyStatePanelStyle.Insert:
                          this.Text = "INS";
                          break;
                      case KeyStatePanelStyle.NumLock:
                          this.Text = "NUM";
                          break;
                      case KeyStatePanelStyle.ScrollLock:
                          this.Text = "SCRL";
                          break;
                  }
              }
              else
              {
                  this.Text = "";
              }
          }
      }

        本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多