如何在我的表单上禁用 RadioGroup 中的三个 RadioButton

How to disable one RadioButton out of three in RadioGroup On my form

我的表格上有一个 TRadioGroup。在 TRadioGroup 中,我添加了 3 个项目。现在我想禁用 TRadioGroup.

中三项中的一项

我该怎么做?我写代码...

TRadioButton(rgbLoadSurveyTypes.Controls[1]).Enabled := True;

...但它给出了错误 "Access Violation"。此错误背后的原因是

rgbLoadSurveyTypes.Controls[1] 给出 null 值并且
rgbLoadSurveyTypes 显示 ControlCount = 0
Item Count = 3

您必须使用按钮 属性 来访问单个 TRadioButton 对象。

RadioGroup1.Buttons[0].Enabled:= false;

Vcl.ExtCtrls.TCustomRadioGroup.Buttons