* UITabControl: 修复屏蔽左右键后其他控件无法使用左右键的问题
This commit is contained in:
parent
f87e366b57
commit
5a22a14fc5
@ -27,6 +27,7 @@ using System.Drawing;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Sunny.UI
|
namespace Sunny.UI
|
||||||
@ -131,9 +132,19 @@ namespace Sunny.UI
|
|||||||
/// Delays the specified ms.
|
/// Delays the specified ms.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ms">The ms.</param>
|
/// <param name="ms">The ms.</param>
|
||||||
public static void Delay(int ms)
|
public static void Sleep(int ms)
|
||||||
{
|
{
|
||||||
System.Threading.Thread.Sleep(Math.Max(0, ms));
|
var sw = Stopwatch.StartNew();
|
||||||
|
var sleepMs = ms - 16;
|
||||||
|
if (sleepMs > 0)
|
||||||
|
{
|
||||||
|
Thread.Sleep(sleepMs);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (sw.ElapsedMilliseconds < ms)
|
||||||
|
{
|
||||||
|
Thread.Sleep(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
* 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 不显示标签页时屏蔽左右键
|
* 2022-04-20: V3.1.5 不显示标签页时屏蔽左右键
|
||||||
|
* 2022-05-11: V3.1.8 修复屏蔽左右键后其他控件无法使用左右键的问题
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using Sunny.UI.Win32;
|
using Sunny.UI.Win32;
|
||||||
@ -198,26 +199,20 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.ProcessCmdKey(ref msg, keyData);
|
if (Focused && !TabVisible)
|
||||||
}
|
{
|
||||||
|
switch (keyData)
|
||||||
|
{
|
||||||
|
case Keys.Left:
|
||||||
|
//if (TabVisible)
|
||||||
|
return true;
|
||||||
|
case Keys.Right:
|
||||||
|
//if (TabVisible)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnKeyDown(KeyEventArgs e)
|
return base.ProcessCmdKey(ref msg, keyData);
|
||||||
{
|
|
||||||
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)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user