1. <i id='DqfFk'><tr id='DqfFk'><dt id='DqfFk'><q id='DqfFk'><span id='DqfFk'><b id='DqfFk'><form id='DqfFk'><ins id='DqfFk'></ins><ul id='DqfFk'></ul><sub id='DqfFk'></sub></form><legend id='DqfFk'></legend><bdo id='DqfFk'><pre id='DqfFk'><center id='DqfFk'></center></pre></bdo></b><th id='DqfFk'></th></span></q></dt></tr></i><div id='DqfFk'><tfoot id='DqfFk'></tfoot><dl id='DqfFk'><fieldset id='DqfFk'></fieldset></dl></div>
      • <bdo id='DqfFk'></bdo><ul id='DqfFk'></ul>
    2. <small id='DqfFk'></small><noframes id='DqfFk'>

    3. <tfoot id='DqfFk'></tfoot>
      <legend id='DqfFk'><style id='DqfFk'><dir id='DqfFk'><q id='DqfFk'></q></dir></style></legend>
    4. TabControl 中的 C# Tab 切换

      时间:2023-06-04
        <tbody id='aWNp6'></tbody>
      <tfoot id='aWNp6'></tfoot>

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

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

                <bdo id='aWNp6'></bdo><ul id='aWNp6'></ul>
                <legend id='aWNp6'><style id='aWNp6'><dir id='aWNp6'><q id='aWNp6'></q></dir></style></legend>
                本文介绍了TabControl 中的 C# Tab 切换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                我正面临这样的问题,我觉得很难克服.在 WinForms 中,我得到了一个带有 n 个 TabPages 的 TabControl.我想扩展 Ctrl+Tab/Ctrl+Shift+Tab 切换.所以我写了一些代码,只要焦点在 TabControl 或 Form 上就可以正常工作.当应用程序焦点位于 TabPage 内部时(例如,位于 TabPage 内部的按钮上),按下 Ctrl+Tab 时,我的代码将被忽略,并且 TabControl 会自行跳到 TabPage(避免我的代码).

                Iam facing such problem, which I find hard to overcome. In WinForms I got a TabControl with n TabPages. I want to extend the Ctrl+Tab / Ctrl+Shift+Tab switching. so I wrote some code which works fine as long as the focus is on TabControl or on the Form. When application focus is INSIDE of TabPage (for example on a button which is placed inside of TabPage), while pressing Ctrl+Tab, my code is ignored and TabControl skips to TabPage on his own (avoiding my code).

                有人知道吗?

                推荐答案

                您需要从 TabControl 派生并覆盖 ProcessCmdKey,虚拟方法才能覆盖 Ctrl-Tab 行为.

                You need to derive from TabControl and override ProcessCmdKey, virtual method in order to override the Ctrl-Tab behavior.

                例子:

                public class ExtendedTabControl: TabControl
                {
                    protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
                    {
                        if (keyData == (Keys.Control | Keys.Tab))
                        {
                            // Write custom logic here
                            return true;
                        }
                        if (keyData == (Keys.Control | Keys.Shift | Keys.Tab))
                        {
                            // Write custom logic here, for backward switching
                            return true;
                        }
                        return base.ProcessCmdKey(ref msg, keyData);
                    }
                }
                

                这篇关于TabControl 中的 C# Tab 切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:删除选项卡上的按钮边框 c# winforms 下一篇:WPF 错误样式仅在选项卡控件的可见选项卡上正确

                相关文章

                最新文章

              • <legend id='lBXmp'><style id='lBXmp'><dir id='lBXmp'><q id='lBXmp'></q></dir></style></legend>

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

                <tfoot id='lBXmp'></tfoot>

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