/// <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 + 8);
}
}
}
以后用 FullTabControl 就行。(这种方法简单)
ps:令 Form.Designer.cs中的this.tabControl1 = new FullTabControl();
2.参见以下网址(VB.NET)代
码:http://www.blueshop.com.tw/board/FUM2005 ... RD201112281018075B8.html
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);
}
}
调用方法:new FullTabControl().AssignHandle(tabControl1.Handle);// tabControl1为窗口上TabControl控件的名称
[本日志由 tiancao1001 于 2021-03-03 04:26 PM 编辑]
|
暂时没有评论
发表评论 - 不要忘了输入验证码哦! |