我创建一个frame,然后在frame里加了一个label,
然后用创建控件数组的方法创建几个frame
鼠标点击frame时弹出一个窗口,在窗口上有一个下拉列表框,里边有几个数,从里边选择一个数,然后点击一个按钮,就把这个值赋给刚才点击的frame上的label上。我现在主要是不知道怎么把点击frame时弹出的窗口里下列表选择的值赋给刚才点击的frame上的label上,请各位指教,谢谢!!

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      for I := 0 to Self.ComponentCount - 1do
      begin
        if (Self.FindComponent('StaticTextN')) is TStaticText then
        begin
          ((Self.FindComponent('StaticTextN')) as TStaticText).Caption := 'Caption';
          ((Self.FindComponent('StaticTextN')) as TStaticText).Left := 100;
          ((Self.FindComponent('StaticTextN')) as TStaticText).Top := 200;
          //
        end;
      end;
    end;