按字体大小缩放单选按钮列表 [英] Scale radio button list with font size
问题描述
当尝试使用单选按钮应用自定义安装掩码时(我在在此使用提供的代码),我看不到使用较高的字体,因为在一个单选按钮字段和另一个单选按钮字段之间应该需要一些间距.为您提供一个直观的示例:
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 :
由于默认字体大小不太容易阅读,我想知道是否有一种方法可以在一个单选按钮字段和下一个单选按钮字段之间增加额外的间距.
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.
推荐答案
在Inno Setup中在运行时创建的复选框和单选按钮不会自动使用DPI/字体大小缩放其高度.
Checkboxes and Radio buttons created on runtime in Inno Setup do not scale their height automatically with a DPI/font size.
因此,您必须以编程方式对其进行缩放.
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;
...
ScaleY(RadioButton.Height)
采用默认的组合框/单选按钮高度,该高度是为默认字体设计的,没有显示缩放比例(100%),并将其缩放到自定义字体和实际显示缩放比例.
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.
尽管请注意,为应用程序/设置使用非默认字体大小不是一个好主意.用户应该在Windows偏好设置中选择自己喜欢的字体大小.您不应该超越他/她的选择.
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.
更改字体大小时,请勿修改共享的default.isl
,请使用改为您的项目文件的[LangOptions]
部分:
When changing the font size, do not modify the shared default.isl
, use the [LangOptions]
section of your project file instead:
[LangOptions]
DialogFontSize=20
这篇关于按字体大小缩放单选按钮列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!