java单选按钮大小和 位置,按字体大小缩放单选按钮列表

When trying to apply a custom installation mask with radio buttons (I used code provided here) I see I am unable to use higher fonts as a little spacing should be needed between one radio button field and another one.To give you a visual example :

hdhhC.jpg

As default font size are not so easy to be read I wonder if there is a way of adding extra spacing between one radio button field and the next one.

解决方案

Checkboxes and Radio buttons created on runtime in Inno Setup do not scale their height automatically with a DPI/font size.

5oTx1.png

So you have to scale them programmatically.

...

RadioButton.Left := WizardForm.TypesCombo.Left;

RadioButton.Height := ScaleY(RadioButton.Height);

RadioButton.Top := WizardForm.TypesCombo.Top + I * RadioButton.Height;

...

The ScaleY(RadioButton.Height) takes the default combobox/radiobutton height, which is designed for the default font and no display scaling (100%) and scales that to the custom font and actual display scaling.

9tx3H.png

Though note that using a non-default font-size for your application/setup is not a good idea. The user should choose a font size he/she is comfortable with in Windows preferences. You should not override his/her choice.

When changing the font size, do not modify the shared default.isl, use the [LangOptions] section of your project file instead:

[LangOptions]

DialogFontSize=20

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值