Reputation: 14860
The tabpages have a padding between the border and the inside controls. Is there a way to remove this padding?
This is necessary as the TabControl will look bad if docked in parent container.
I tried some method overriding yet, but it didn't work.
Upvotes: 2
Views: 4235
Reputation: 14860
I found out it can be achieved using WndProc
:
public class TabControl2 : TabControl
{
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x1300 + 40)
{
RECT rc = (RECT)m.GetLParam(typeof(RECT));
rc.Left -= 7;
rc.Right += 7;
rc.Top -= 2;
rc.Bottom += 7;
Marshal.StructureToPtr(rc, m.LParam, true);
}
base.WndProc(ref m);
}
}
public struct RECT
{
public int Left, Top, Right, Bottom;
}
Upvotes: 7