Delphi RadioButton问题

来源:百度知道 编辑:UC知道 时间:2024/05/15 19:46:59
我有一个GroupBox,里面有4个RadioButton,还有1个BUTTON,我现在选中第1个RadioButton了,我希望当我点击BUTTON时,RadioButton都恢复到原始没有倍选中的状态,请问该怎么办啊~请前辈赐教
3楼的方法我试了,不行啊,是不是写错了?

为什不用RadioGroup呢?增加4个items,更方便!
procedure TForm1.Button1Click(Sender: TObject);
begin
radiogroup1.ItemIndex:=-1;
end;

button.onclick{
radiobutton1.enabled=false;
radiobutton2.enabled=false;
radiobutton3.enabled=false;
radiobutton4.enabled=false;
}

procedure TForm1.Button1Click(Sender: TObject);
var
i:integer;
begin
for I:=0 to GroupBox1.ControlCount-1 do
if GroupBox1.Controls[i] is TRadioButton then
(GroupBox1.Controls[i] As TRadioButton).Checked:=false;
end;