delphi中 groupbox 里radiobutton caption 显示到listbox
3个回答
展开全部
在确定按钮点击事件中判断radiobutton.Checked 属性是否为true 也就是是否选中 如果选中的话添加到listbox中ListBox1.Items.Add(radiobutton.caption);
例如:
procedure TForm1.Button1Click(Sender: TObject);
begin
if RadioButton1.Checked then
ListBox1.Items.Add(RadioButton1.Caption);
if CheckBox1.Checked then
ListBox1.Items.Add(CheckBox1.Caption);
end;
例如:
procedure TForm1.Button1Click(Sender: TObject);
begin
if RadioButton1.Checked then
ListBox1.Items.Add(RadioButton1.Caption);
if CheckBox1.Checked then
ListBox1.Items.Add(CheckBox1.Caption);
end;
展开全部
So easy!
双击确定按钮,在事件里这样写
var
i:integer
if radioButton1.checked then listbox1.Items.Strings[0]:= radioButton1.caption
else listbox1.Items.Strings[0]:= radioButton2.caption;
if radioButton3.checked then listbox1.Items.Strings[1]:= radioButton3.caption
else listbox1.Items.Strings[1]:= radioButton4.caption;
i:=2
if checkbox1.checked then
begin
listbox1.Items.Strings[i]:= checkbox1.caption;
i:=i+1;
end;
if checkbox2.checked then
begin
listbox1.Items.Strings[i]:= checkbox2.caption;
i:=i+1;
end;
if checkbox3.checked then
begin
listbox1.Items.Strings[i]:= checkbox3.caption;
i:=i+1;
end;
if checkbox4.checked then
begin
listbox1.Items.Strings[i]:= checkbox4.caption;
i:=i+1;
end;
结束~欢迎追问
双击确定按钮,在事件里这样写
var
i:integer
if radioButton1.checked then listbox1.Items.Strings[0]:= radioButton1.caption
else listbox1.Items.Strings[0]:= radioButton2.caption;
if radioButton3.checked then listbox1.Items.Strings[1]:= radioButton3.caption
else listbox1.Items.Strings[1]:= radioButton4.caption;
i:=2
if checkbox1.checked then
begin
listbox1.Items.Strings[i]:= checkbox1.caption;
i:=i+1;
end;
if checkbox2.checked then
begin
listbox1.Items.Strings[i]:= checkbox2.caption;
i:=i+1;
end;
if checkbox3.checked then
begin
listbox1.Items.Strings[i]:= checkbox3.caption;
i:=i+1;
end;
if checkbox4.checked then
begin
listbox1.Items.Strings[i]:= checkbox4.caption;
i:=i+1;
end;
结束~欢迎追问
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用 TRadioGroup
TRadioGroup represents a group of radio buttons that function together.
Unit
ExtCtrls
Description
A TRadioGroup object is a special group box that contains only radio buttons. Radio buttons that are placed directly in the same control component are said to be rouped.?When the user checks a radio button, all other radio buttons in its group become unchecked. Hence, two radio buttons on a form can be checked at the same time only if they are placed in separate containers, such as group boxes.
To add radio buttons to a TRadioGroup, edit the Items property in the Object Inspector. Each string in Items makes a radio button appear in the group box with the string as its caption. The value of the ItemIndex property determines which radio button is currently selected.
Display the radio buttons in a single column or in multiple columns by setting the Columns property.
Note: Setting the radio group BiDiMode to bdRightToLeft automatically flips its radio buttons. The FlipChildren method has no effect.
TRadioGroup represents a group of radio buttons that function together.
Unit
ExtCtrls
Description
A TRadioGroup object is a special group box that contains only radio buttons. Radio buttons that are placed directly in the same control component are said to be rouped.?When the user checks a radio button, all other radio buttons in its group become unchecked. Hence, two radio buttons on a form can be checked at the same time only if they are placed in separate containers, such as group boxes.
To add radio buttons to a TRadioGroup, edit the Items property in the Object Inspector. Each string in Items makes a radio button appear in the group box with the string as its caption. The value of the ItemIndex property determines which radio button is currently selected.
Display the radio buttons in a single column or in multiple columns by setting the Columns property.
Note: Setting the radio group BiDiMode to bdRightToLeft automatically flips its radio buttons. The FlipChildren method has no effect.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询