如何消除TabControl上的空白?

时间:2012-06-24 15:38:06

标签: c# winforms tabcontrol

有人可以知道如何避免TabControl和TabControl本身页面之间的左右间隙(每个大约5-10 px)。我尝试了一切。所有边距和填充均为零。

1 个答案:

答案 0 :(得分:0)

一位恼怒的微软程序员在TabPage的源代码中留下了一条评论:

    //HACK: to ensure that the tabpage draws correctly (the border will get clipped and
    // and gradient fill will match correctly with the tabcontrol).  Unfortunately, there is no good way to determine
    // the padding used on the tabpage.
    // I would like to use the following below, but GetMargins is busted in the theming API:
    //VisualStyleRenderer visualStyleRenderer = new VisualStyleRenderer(VisualStyleElement.Tab.Pane.Normal);
    //Padding themePadding = visualStyleRenderer.GetMargins(e.Graphics, MarginProperty.ContentMargins);

归功于:Hans Passant: - )