问题描述
我想动态设置 TBitBtn
的anchor属性。
I want to set TBitBtn
's anchor property dynamically.
首先,我将按钮的锚设置为设计时间的右上角。在该按钮单击事件中,我将表单的 BorderStyle
设置为 bsDialog
。然后应该有一个间隙,如图所示。我希望按钮应该在关闭按钮旁边。
First I have set the button's anchor as top right in design time. In that button click event I set form's BorderStyle
as bsDialog
. Then there should be a gap as shown in image. I want the button should be beside close button.
因此,在将边框样式指定为 bsDialog之后,我需要将按钮的左侧及其锚点设置为右上角
。这是对的吗?
So I need to set button's left and its anchor as top right after assigning border style as bsDialog
. Is it correct?
我不知道动态更改锚属性的方法
I don't know the way to change anchor property dynamically
谢谢Rakesh
推荐答案
我不知道能不能看到你的问题。如果是关于语法的,那么您就可以这样做:
I don't know if I can see your problem. If it's about syntax then here you go:
BitBtn1.Left:= 666;
BitBtn1.Anchors := [akTop, akRight];
这是修改位置和锚定代码的方法。
This is the way to modify position and anchor in code.
这篇关于如何动态设置按钮的anchor属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!