下面两行代码有什么区别.两者都试图获得路径,一个正在运行,另一个正在抛出错误.我正在研究Delphi-7
Path:= (((FFormOwner as TForm).Designer) as IDesigner).GetPrivateDirectory; --Working
Path:= IDesigner(TForm(FFormOwner).Designer).GetPrivateDirectory ; --Error
Run Code Online (Sandbox Code Playgroud)
下面是使用代码行来获取路径的代码.
constructor TsampleComponent.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FFormOwner:=TForm(Owner);
if not (Owner is TForm) then
repeat
FFormOwner:=TForm(FFormOwner.Owner);
until (FFormOwner is TForm) or (FFormOwner.Owner=nil);
if (csDesigning in ComponentState) then
Path:= (((FFormOwner as TForm).Designer) as IDesigner).GetPrivateDirectory
else
Path:=ExtractFilePath(Application.EXEName);
.
.
end;
Run Code Online (Sandbox Code Playgroud) 我正在使用Delphi 7.我想更改messageDlg宽度.
我的意思是我的消息测试很长,因为该消息显示在2行,但我想只在一行显示消息.
下面是我的单行代码
MessageDlg('i want to display only in oneline i want to display only in oneline i want to display only in oneline i want to display only in oneline i want to display only in oneline',mtError,[mbok],0)
Run Code Online (Sandbox Code Playgroud)
上面的消息显示在2行,但我想只在一行显示消息.