强制转换,主要用于将对象的转换,父类转换为子类 如: procedure TForm1.FormShow(Sender: TObject); begin (Sender As TForm1).Caption := 'Test'; end;
UP! 来迟一步! 强制转换,主要用于将对象的转换,父类转换为子类 如: procedure TForm1.FormShow(Sender: TObject); begin if Sender is TForm1 then (Sender As TForm1).Caption := 'Test'; end;
强制转换,主要用于将对象的转换,父类转换为子类 如: procedure TForm1.FormShow(Sender: TObject); begin if Sender is TForm1 then (Sender As TForm1).Caption := 'Test'; //也可以用TForm1(Sender).Caption := 'Test';//要快些 end;
如:
procedure TForm1.FormShow(Sender: TObject);
begin
(Sender As TForm1).Caption := 'Test';
end;
来迟一步!
强制转换,主要用于将对象的转换,父类转换为子类
如:
procedure TForm1.FormShow(Sender: TObject);
begin
if Sender is TForm1 then
(Sender As TForm1).Caption := 'Test';
end;
如:
procedure TForm1.FormShow(Sender: TObject);
begin
if Sender is TForm1 then (Sender As TForm1).Caption := 'Test';
//也可以用TForm1(Sender).Caption := 'Test';//要快些
end;