简体   繁体   English

检索GroupBox边框大小

[英]Retrieve GroupBox border size

I am manually resizing a GroupBox based on its content. 我正在根据其内容手动调整GroupBox的大小。 To give it the proper size, it needs to be Content.Size + Border.Size . 为了给它合适的大小,它必须是Content.Size + Border.Size

How do I figure out what the size of the GroupBox border is? 如何确定GroupBox边框的大小?

You can use the DisplayRectangle property as a base for the calculations: 您可以使用DisplayRectangle属性作为计算的基础:

var bounds = groupBox.Bounds;
var displayRect = groupBox.DisplayRectangle;
var borderSize = new Size(bounds.Width - displayRect.Width, bounds.Height - displayRect.Height);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM