Delphi的控件可以直接赋值给变量吗?
procedure TForm1.Button1Click(Sender: TObject);
var
temp:string;
begin
if RadioButton15.Checked=True then
temp:=memo1;
if RadioButton16.Checked=True then
temp:=memo1;
..........
end; Delphi的控件可以直接赋给变量吗?是类型不对还是Delphi不能这样赋值?
procedure TForm1.Button1Click(Sender: TObject);
var
temp:string;
begin
if RadioButton15.Checked=True then
temp:=memo1;
if RadioButton16.Checked=True then
temp:=memo1;
..........
end; Delphi的控件可以直接赋给变量吗?是类型不对还是Delphi不能这样赋值?
可以直接赋值,temp是string类型
这样可以了temp:=memo1.text;
temp.text:=temp.text+'文本'; {相当于:memo1.text:=memo1.text+'文本';}这样行么?
这样行
temp:=memo1.text+'文本';这样也行
但是temp是string类型,不是memo类型,没有TEXT属性
要不你这样定义,temp:TMemo;
然后ctreat
但是能不能temp:=memo1我就不知道了
begin
if RadioButton15.Checked=True then
temp:=memo1; if RadioButton16.Checked=True then
temp:=memo2;
temp.text:='文本';这样可以了!主要是 var temp:TMemo;这里,这样声明就可以了,谢谢你~