delphi中 groupbox 里radiobutton caption 显示到listbox

点击选择的radiobutton点击确定按钮显示到listbox里确定按钮代码如何写... 点击选择的radiobutton 点击确定按钮 显示到listbox里 确定按钮代码如何写 展开
 我来答
fenghanly
2011-12-20 · TA获得超过904个赞
知道小有建树答主
回答量:89
采纳率:0%
帮助的人:111万
展开全部
在确定按钮点击事件中判断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;
w198933333
2011-12-20 · 超过21用户采纳过TA的回答
知道答主
回答量:102
采纳率:0%
帮助的人:36.5万
展开全部
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;

结束~欢迎追问
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
bd9006
2011-12-20 · TA获得超过2.5万个赞
知道大有可为答主
回答量:4.8万
采纳率:63%
帮助的人:1.6亿
展开全部
用 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.
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式