在 Duilib 中,要设置 Option
控件距离左边框一定的宽度,可以通过调整其 x
属性来实现。你可以在每个 Option
标签中添加一个 x
属性,设定其值为 10(或者你想要的其他值)。以下是你的代码示例,修改后的版本:
<VerticalLayout height="560" bordersize="1" width="210" bordercolor="#00DCDCDD">
<Control height="2" />
<Option group="quickbar" normalimage="settingbtn\changgui_nor.png" float="false" hotimage="settingbtn\changgui_hot.png" selectedimage="settingbtn\changgui_hot.png" name="commonopt" height="30" width="200" x="10"/>
<Option group="quickbar" normalimage="settingbtn\tuisong_nor.png" float="false" hotimage="settingbtn\tuisong_hot.png" selectedimage="settingbtn\tuisong_hot.png" name="movement" height="30" width="200" x="10"/>
<Option group="quickbar" name="topgrade" height="30" width="200" normalimage="settingbtn\gaoji_nor.png" float="false" hotimage="settingbtn\gaoji_hot.png" selectedimage="settingbtn\gaoji_hot.png" x="10"/>
<Option group="quickbar" name="address" height="30"
width="{your_width}" normalimage="{your_image_path}"
float="{your_float}" hotimage="{your_hover_image_path}"
selectedimage="{your_selected_image_path}"
x="{desired_x}"/>
<Option group='quickbar' name='communpwd' height='30' width='200'
normalimage='settingbtn\tongxun_nor.png' float='false'
hotimage='settingbtn\tongxun_hot.png' selectedimage='settingbtn\tongxun_hot.png' x='10'/>
<Option group='quickbar' name='loginpwd' height='30' width='200'
normalimage='settingbtn\denglu_nor.png' float='false'
hotimage='settingbtn\denglu_hot.png' selectedimage='settingbtn\denglu_hot.png' x='10'/>
<Option group='quickbar' name='aboutbtn' height='30'
width='{your_width}' normalimage='{your_image_path}'
float='{your_float}' hotimage='{your_hover_image_path}'
selectedimage='{your_selected_image_path}'
x='{desired_x}'/>
<Control height=\"2\"/>
</VerticalLayout>
请注意,这里使用了 x=“10”
来设置每个选项控件离左边框的距离。你可以根据需要调整这个值。
内容由零声教学AI助手提供,问题来源于学员提问