* UITabControl: 不显示标签页时屏蔽左右键

This commit is contained in:
Sunny 2022-04-20 11:24:42 +08:00
parent d581637b99
commit 38ee57eaaa

View File

@ -26,6 +26,7 @@
* 2022-01-02: V3.0.9 * 2022-01-02: V3.0.9
* 2022-01-13: V3.1.0 * 2022-01-13: V3.1.0
* 2022-04-18: V3.1.5 * 2022-04-18: V3.1.5
* 2022-04-20: V3.1.5
******************************************************************************/ ******************************************************************************/
using Sunny.UI.Win32; using Sunny.UI.Win32;
@ -200,6 +201,25 @@ namespace Sunny.UI
return base.ProcessCmdKey(ref msg, keyData); 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)] [DefaultValue(true)]
[Description("是否禁用Ctrl+Tab"), Category("SunnyUI")] [Description("是否禁用Ctrl+Tab"), Category("SunnyUI")]
public bool ForbidCtrlTab { get; set; } = true; public bool ForbidCtrlTab { get; set; } = true;