开发者

Delphi Change modal form Caption

How Can I change a modal forms caption while it is showing, from within the开发者_如何转开发 modal form.

Thanks

Colin


The same way as you change the caption of any form.

There are a thousand ways, depending on when you want to change the caption. One way is this: Drop a TButton on your modal form, and write

procedure TForm2.Button1Click(Sender: TObject);
begin
  Caption := 'New caption';
end;


procedure MyMainForm.ShowForm(ACaption: String);
var
  dlgForm: TForm;
begin
  dlgForm:= TForm.Create(Nil);
  try
    dlgForm.Caption:= ACaption;
    dlgForm.ShowModal;
  finally
    FreeAndNil(dlgForm);
  end;
end;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜