delphi TSaveDialog

TSaveDialog
预览
        

实现过程

 

 

动态创建和使用保存文件对话框
procedure TForm1.Button1Click(Sender: TObject);
begin
  with TSaveDialog.Create(nil) do
  begin
     Filter:='Text files (*.txt)|*.txt)|All Files(*.*)|*.*';
    if Execute then
       Memo1.Lines.LoadFromFile(Filename);
  end;
end;
    
 
//保存图片的对话框
procedure TForm2.Button1Click(Sender: TObject);
begin
    with TSaveDialog.Create(nil) do
    begin
      Filter:='JPEG file(*.jpg;*.jpeg)|*.jpg;*.jpeg|PNG file(*.png)|*.png|Bitmap file(*.bmp)|*.bmp|All Files(*.*)|*.*';
      if Execute then
          Image1.Picture.SaveToFile(Filename)
    end;
end;
 
 
备注
    所有的对话框都可以使用此方法来制作
     Filter:='Text files (*.txt;*.ini;*.log)|*.txt;*.ini;*.log)|All Files(*.*)|*.*';   
 
设置好Filer Editor会自动产生代码
链接
    
 
 




附件列表

     

    posted @ 2013-10-16 21:53  XE2011  阅读(767)  评论(0编辑  收藏  举报