Here's how to fix it <span class="Apple-converted-space"></span> :
1. Create a new class directly, inherit TabControl, and then override DisplayRectangle method: <span class="Apple-converted-space"></span>
Copy Code code as follows:
///<summary>
///Solution TabControl redundant margin problem
///</summary>
public class Fulltabcontrol:tabcontrol {
public override Rectangle DisplayRectangle {
get {
Rectangle rect = base. DisplayRectangle;
Return to New Rectangle (rect. Left-4, Rect. Top-4, Rect. Width + 8, rect. Height + 7);
}
}
}
later use Fulltabcontrol on the line. (This method is simple) <span class="Apple-converted-space"></span>
2. See the following URL (vb.net) code: <span class="Apple-converted-space"></span>
http://www.blueshop.com.tw/board/FUM20050124191756KKC/BRD201112281018075B8.html
C # code is: <span class="Apple-converted-space"></span>
Copy Code code as follows:
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) { <span class="Apple-converted-space"></span>
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);
}
}
Call Method: New Fulltabcontrol (). Assignhandle (Tabcontrol1.handle);//TabControl1 is the name of the TabControl control <span class="Apple-converted-space"></span> on the window
Copyright Statement Author: Xiarong
e-mail: Lyout (at) 163.com