delphi中打开图片实例demo——2014005

页面导航:首页 > 软件编程 > Delphi > delphi中打开图片实例demo——2014005

delphi中打开图片实例demo——2014005

来源: 作者: 时间:2016-01-15 15:17 【

unit uOpenFile;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ExtDlgs,jpeg;type TForm1 = c

 

 

 

unit uOpenFile;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, ExtDlgs,jpeg;

type
  TForm1 = class(TForm)
    btnOpenFile: TButton;
    image: TImage;

    OpenDialog: TOpenDialog;

    procedure btnOpenFileClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.btnOpenFileClick(Sender: TObject);
var
  openPath:string;
begin
   OpenDialog.Title := '打开图片';
   OpenDialog.filter :=  '全部 (*.jpg;*.jpeg;*.bmp;*.ico;*.emf;*.wmf;*.png)|*.jpg;*.jpeg;*.bmp;*.i' + 
      'co;*.emf;*.wmf;*.png|JPEG 图像文件 (*.jpg)|*.jpg|JPEG 图像文件 (*.jpeg)|*.jpeg' + 
      '|位图 (*.bmp)|*.bmp|图标 (*.ico)|*.ico|增强图元文件 (*.emf)|*.emf|图元文件 (*.' + 
      'wmf)|*.wmf|可移植图片(*.png)|*.png';



  if openDialog.Execute then
  begin
      openPath:=OpenDialog.FileName;
      image.Picture.LoadFromFile(openPath);
      image.AutoSize:=False;
      image.Stretch:=True;
  end;

  end;

end.


 

Tags:

文章评论

最 近 更 新
热 点 排 行
Js与CSS工具
代码转换工具

<