复制代码 代码如下:
/// <summary>
/// 解决系统TabControl多余边距问题
/// </summary>
public class FullTabControl : TabControl {
public override Rectangle DisplayRectangle {
get {
Rectangle rect = base.DisplayRectangle;
return new Rectangle(rect.Left - 4, rect.Top - 4, rect.Width + 8, rect.Height + 7);
}
}
}
复制代码 代码如下:
public class FullTabControl : NativeWindow {
static int TCM_FIRST = 0x1300;
static int TCM_ADJUSTRECT = (TCM_FIRST + 40);
struct RECT{
public int Left, Top, Right, Bottom;
}
protected override void WndProc(ref Message m) {
if (m.Msg == TCM_ADJUSTRECT) {
RECT rc = (RECT)m.GetLParam(typeof(RECT));
rc.Left -= 4;
rc.Right += 3;
rc.Top -= 4;
rc.Bottom += 3;
Marshal.StructureToPtr(rc, m.LParam, true);
}
base.WndProc(ref m);
}
}
新闻热点
疑难解答
图片精选