哦, 对不起,现在我知道你的意思了,都显示在一行上,一行满后换行,对吗? 这样就可以了: procedure TForm1.ComboBox1Click(Sender: TObject); var s:string;i:integer; begin if memo1.Text<>'' then begin memo1.MaxLength:=100;//定义一行显示的最大长度 s:=memo1.Text;//记录第一个字串 memo1.Lines.Text:=s+' '+combobox1.Text;//显示出字串 i:=length(memo1.text);//记录字串长度 if i>100 then memo1.Lines.Add(combobox1.text);//如果到了最大长度,就增加一行 end; end; 试试吧!!!!^_^
str := combobox1.Text;
memo1.Lines.Add(str);
是可以放过去了,但是它是成一列放在memo1中的,怎样成一行行的放在memo1中,当memo1中满一行后,怎么换行?
在combobox1 的onclick事件中写:memo1.lines.add(combobox1.text);就可以了!!!
这样就可以了:
procedure TForm1.ComboBox1Click(Sender: TObject);
var s:string;i:integer;
begin
if memo1.Text<>'' then
begin
memo1.MaxLength:=100;//定义一行显示的最大长度
s:=memo1.Text;//记录第一个字串
memo1.Lines.Text:=s+' '+combobox1.Text;//显示出字串
i:=length(memo1.text);//记录字串长度
if i>100 then memo1.Lines.Add(combobox1.text);//如果到了最大长度,就增加一行
end;
end;
试试吧!!!!^_^