📄 xcontrolhelper.cs
字号:
namespace Imps.Client.Pc.Controls
{
using System;
using System.Drawing;
using System.Windows.Forms;
public class XControlHelper
{
public static Rectangle GetWorkRectangle(Rectangle drawRectangle, Padding padding, BorderStyle style)
{
Rectangle rectangle = drawRectangle;
if (style != BorderStyle.None)
{
if (style == BorderStyle.Fixed3D)
{
padding.set_Left(padding.get_Left() + 2);
padding.set_Right(padding.get_Right() + 2);
padding.set_Top(padding.get_Top() + 2);
padding.set_Bottom(padding.get_Bottom() + 2);
}
else if (style == BorderStyle.FixedSingle)
{
padding.set_Left(padding.get_Left() - 1);
padding.set_Right(padding.get_Right() - 1);
padding.set_Top(padding.get_Top() - 1);
padding.set_Bottom(padding.get_Bottom() - 1);
}
}
if (((padding.get_Left() != 0) || (padding.get_Right() != 0)) || ((padding.get_Top() != 0) || (padding.get_Bottom() != 0)))
{
rectangle.X += padding.get_Left();
rectangle.Y += padding.get_Top();
rectangle.Width = (rectangle.Width - padding.get_Right()) - padding.get_Left();
rectangle.Height = (rectangle.Height - padding.get_Bottom()) - padding.get_Bottom();
}
return rectangle;
}
public static bool IsMouseOnControl(Control control, Control parentControl)
{
return control.Bounds.Contains(parentControl.PointToClient(Control.MousePosition));
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -