0

有人可以知道如何避免 TabControl 上的页面和 TabControl 本身之间的左右间隙(每个大约 5-10 像素)。我什么都试过了。所有边距和填充均为零。

4

1 回答 1

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 :-)

于 2012-06-25T00:01:21.333 回答