动态地将控件置于组框中 [英] Center a control in a group box dynamically

查看:69
本文介绍了动态地将控件置于组框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够(在运行时)将控件(如文本框)集中在一个组框内。什么是最好的计算方法?

框架中有什么东西能告诉你INSIDE一个组合框吗?一个

如何占据奇怪的组框边距? (即顶线,名称

,似乎比groupbox边框的其余部分大)


Tom

I want to be able (at run time) to center a control (like a text box) inside
a group box. Whats the best way to calculate this? Is there something in the
framework that tells you the area INSIDE a group box? And how does one
account for the wierd groupbox margins? (i.e. the top line, where the name
is, seems bigger than the rest of the groupbox border)

Tom

推荐答案

你好汤姆,


我想你会在开始做难之前先看一下锚点

因为这是一个特殊的财产


Cor
Hi Tom,

I think you would have a look at the anchor before you start doing difficult
things wherefore is a special property

Cor


Cor:我不确定你在说什么......是否有什么

说明了groupbox边框宽度是多少?顶部和侧面都是?


Tom


" Cor Ligthert" <无********** @ planet.nl>写在消息

新闻:ug ************** @ TK2MSFTNGP10.phx.gbl ...
Cor: I am not exactly sure what you are talking about... Is there anything
that says what the groupbox border width is? Both the top and the sides?

Tom

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:ug**************@TK2MSFTNGP10.phx.gbl...
嗨汤姆,

我想你在开始做
困难的事情之前会先看一下锚点因此是一个特殊的财产

Cor
Hi Tom,

I think you would have a look at the anchor before you start doing difficult things wherefore is a special property

Cor



嗨Tom,


尝试这个比你看到的更好。


制作一个项目


在表单中设置一个groupbox并将dock属性设置为Fill(单击

middle)

设置在该组框中一个文本框并将锚属性设置为

所有方面(单击所有箭头)


运行它并调整大小


(这一切都可以由设计师完成)


我希望这个说清楚,否则我会以另一种方式告诉它。


Cor
Hi Tom,

Try this than you see it.

Make a project

Set a groupbox in a form and set the dock properties to Fill (clicking the
middle)
Set in that groupbox a textbox and set the anchor properties from that to
all sides (clicking all arrows)

Run it and resize

(This all can done by the designer)

I hope this makes it clear otherwise ask than I tell it in another way.

Cor


这篇关于动态地将控件置于组框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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