我如何实现关联?

nanyankaoran 2008-11-19 11:00:47
var
Form1: TForm1;
RB:TRadioButton ;
implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
i:Integer ;
col:Integer ;
Row:Integer ;
Mlist:array[0..9]of string ;
begin
combobox1.Clear ;
col:=0;
Row:=0 ;
for i:=0 to 9 do
begin

Mlist[i] :=IntToStr(i);

RB:=TRadioButton.Create(self);
RB.Caption :=Mlist[i];

GroupBox1.InsertControl(RB);
RB.Width :=60;
RB.Left :=GroupBox1.ClientRect.Left+5 + Row*rb.Width ;
if (RB.Left +rb.Width )>=(GroupBox1.Width - 50 )then
begin
row:= 0 ;
Inc(col);
end
else
Inc(Row );
if i= 0 then Row := 0 ;
RB.Left:=GroupBox1.ClientRect.Left +5 +row*rb.Width ;
RB.Top :=GroupBox1.ClientRect.Top + 18 +col*rb.Height ;
ComboBox1.AddItem(Mlist[i],RB );
end;
end;
上面我已实现了把TRadioButton加到groupbox中,我下面]如何实现在combobox中选一项那一项就选中
...全文
49 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
bdmh 2008-11-19
  • 打赏
  • 举报
回复
写一个函数付给groupbox的selectchange事件

16,749

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧