<bdo id='rlgSd'></bdo><ul id='rlgSd'></ul>
  1. <tfoot id='rlgSd'></tfoot>

      <small id='rlgSd'></small><noframes id='rlgSd'>

      <legend id='rlgSd'><style id='rlgSd'><dir id='rlgSd'><q id='rlgSd'></q></dir></style></legend>
      <i id='rlgSd'><tr id='rlgSd'><dt id='rlgSd'><q id='rlgSd'><span id='rlgSd'><b id='rlgSd'><form id='rlgSd'><ins id='rlgSd'></ins><ul id='rlgSd'></ul><sub id='rlgSd'></sub></form><legend id='rlgSd'></legend><bdo id='rlgSd'><pre id='rlgSd'><center id='rlgSd'></center></pre></bdo></b><th id='rlgSd'></th></span></q></dt></tr></i><div id='rlgSd'><tfoot id='rlgSd'></tfoot><dl id='rlgSd'><fieldset id='rlgSd'></fieldset></dl></div>

      .net右移键和左移键之间的区别

      时间:2023-07-26

      <small id='TqI3A'></small><noframes id='TqI3A'>

        <tbody id='TqI3A'></tbody>
      <i id='TqI3A'><tr id='TqI3A'><dt id='TqI3A'><q id='TqI3A'><span id='TqI3A'><b id='TqI3A'><form id='TqI3A'><ins id='TqI3A'></ins><ul id='TqI3A'></ul><sub id='TqI3A'></sub></form><legend id='TqI3A'></legend><bdo id='TqI3A'><pre id='TqI3A'><center id='TqI3A'></center></pre></bdo></b><th id='TqI3A'></th></span></q></dt></tr></i><div id='TqI3A'><tfoot id='TqI3A'></tfoot><dl id='TqI3A'><fieldset id='TqI3A'></fieldset></dl></div>
          <legend id='TqI3A'><style id='TqI3A'><dir id='TqI3A'><q id='TqI3A'></q></dir></style></legend>

              <bdo id='TqI3A'></bdo><ul id='TqI3A'></ul>
              <tfoot id='TqI3A'></tfoot>
              1. 本文介绍了.net右移键和左移键之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我目前正在开发一个应用程序,该应用程序需要根据用户是按下右移键还是左移键(RShiftKey、LShiftKey)而需要不同的行为,但是当按下这些键中的任何一个时,我只能看到 ShiftKey |换档.

                I am currently working on an application which requires different behaviour based on whether the user presses the right or left shift key (RShiftKey, LShiftKey), however when either of these keys is pressed I only see ShiftKey | Shift.

                我的键盘有问题吗?(笔记本电脑)我是否需要一个新的键盘驱动程序/键盘才能发送不同的键盘命令...

                Is there something wrong with my keyboard? (laptop) do I need a new keyboard driver/keyboard in order to send the different key commands maybe...

                目前这是一个相当大的问题,因为没有办法测试代码是否有效(除了单元测试).有人对不同的 shift/alt/ctrl 键有任何经验吗?

                This is a pretty massive problem at the moment, as there is no way of testing that the code works (apart from unit tests). Anyone had any experience of the different shift/alt/ctrl keys?

                推荐答案

                我不知道这篇文章是否对你有帮助,但看起来你可能不得不搞砸 InteropServices 和 Diagnostics:

                I don't know if this post will help you or not, but it looks like you may have to mess with InteropServices and Diagnostics:

                MSDN 论坛:如何发送左/右shift键

                我终于弄明白了如何让 GetAsyncKeyState() 工作,正如 adrianbanks 透露的那样.

                I finally figured out how to make GetAsyncKeyState() work, as adrianbanks revealed.

                [System.Runtime.InteropServices.DllImport("user32.dll")]
                private static extern short GetAsyncKeyState(Keys vKey);
                
                private void theForm_KeyDown(object sender, KeyEventArgs e)
                {
                    if (e.KeyCode == Keys.ShiftKey)
                    {
                        if (Convert.ToBoolean(GetAsyncKeyState(Keys.LShiftKey)))
                        {
                            Console.WriteLine("Left");
                        }
                        if (Convert.ToBoolean(GetAsyncKeyState(Keys.RShiftKey)))
                        {
                            Console.WriteLine("Right");
                        }
                    }
                }
                

                这篇关于.net右移键和左移键之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何使用 C# 按下一个键并释放它? 下一篇:在另一个应用程序中模拟按键和按键释放?

                相关文章

                  <tfoot id='YqvwE'></tfoot>
                  <i id='YqvwE'><tr id='YqvwE'><dt id='YqvwE'><q id='YqvwE'><span id='YqvwE'><b id='YqvwE'><form id='YqvwE'><ins id='YqvwE'></ins><ul id='YqvwE'></ul><sub id='YqvwE'></sub></form><legend id='YqvwE'></legend><bdo id='YqvwE'><pre id='YqvwE'><center id='YqvwE'></center></pre></bdo></b><th id='YqvwE'></th></span></q></dt></tr></i><div id='YqvwE'><tfoot id='YqvwE'></tfoot><dl id='YqvwE'><fieldset id='YqvwE'></fieldset></dl></div>

                  <legend id='YqvwE'><style id='YqvwE'><dir id='YqvwE'><q id='YqvwE'></q></dir></style></legend>

                    <small id='YqvwE'></small><noframes id='YqvwE'>

                      <bdo id='YqvwE'></bdo><ul id='YqvwE'></ul>