如何删除在的WinForms容器控件的边界填充? [英] How can I remove the border padding on container controls in WinForms?

查看:238
本文介绍了如何删除在的WinForms容器控件的边界填充?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设置margin和padding为0,0 0 0,但是这并没有对我的任何的TabControls影响。你看:

I set margin and padding to 0 0 0 0 but that doesn't have any effect for my TabControls. Look:

下面是我在说什么。我要坚持的边界在一起。

Here is what I am talking about. I want to stick the borders together.

我怎样才能做到这一点?

How can I do this?

@Henk Holterman ? - 是的,有什么不对的地方。

@Henk Holterman - yes, what's wrong with it ?

推荐答案

还有留在源$ C ​​$下TabPage的评论由愤怒的微软程序员(编辑以适应页面):

There's a comment left in the source code for TabPage by an exasperated Microsoft programmer (edited to fit the page):

//HACK: to ensure that the tabpage draws correctly (the border will get 
//  clipped 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);

视觉风格是一个重要的错误工厂,特别是因此对于TabControl的。检查<一href="http://stackoverflow.com/questions/4928076/winforms-tabcontrol-alignment-problems/4928416#4928416">this回答一种方式,有选择地关闭它的​​TabControl的,所以你会得到你习惯的行为。当然,它的没有的改变外观。

Visual Styles have been a major bug factory, particularly so for TabControl. Check this answer for a way to selectively turn it off for the TabControl so you'll get the behavior you are used to. Of course it does change the appearance.

这篇关于如何删除在的WinForms容器控件的边界填充?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆