From 38ee57eaaa42b34b3a810b9f3af99ea17fa17514 Mon Sep 17 00:00:00 2001 From: Sunny Date: Wed, 20 Apr 2022 11:24:42 +0800 Subject: [PATCH] =?UTF-8?q?*=20UITabControl:=20=E4=B8=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E9=A1=B5=E6=97=B6=E5=B1=8F=E8=94=BD=E5=B7=A6?= =?UTF-8?q?=E5=8F=B3=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI/Controls/UITabControl.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/SunnyUI/Controls/UITabControl.cs b/SunnyUI/Controls/UITabControl.cs index 0dbd9c9b..418756ad 100644 --- a/SunnyUI/Controls/UITabControl.cs +++ b/SunnyUI/Controls/UITabControl.cs @@ -26,6 +26,7 @@ * 2022-01-02: V3.0.9 增加角标 * 2022-01-13: V3.1.0 修改删除页面时的页面跳转 * 2022-04-18: V3.1.5 关闭按钮增加鼠标移入的效果 + * 2022-04-20: V3.1.5 不显示标签页时屏蔽左右键 ******************************************************************************/ using Sunny.UI.Win32; @@ -200,6 +201,25 @@ namespace Sunny.UI return base.ProcessCmdKey(ref msg, keyData); } + protected override void OnKeyDown(KeyEventArgs e) + { + if (!TabVisible) + { + if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Right) + { + e.Handled = true; + } + else + { + base.OnKeyDown(e); + } + } + else + { + base.OnKeyDown(e); + } + } + [DefaultValue(true)] [Description("是否禁用Ctrl+Tab"), Category("SunnyUI")] public bool ForbidCtrlTab { get; set; } = true;