unit Unit1;

procedure TForm1.Button1Click(Sender: TObject,’,’,’);
var
  jpg: TJPEGImage; // 要use Jpeg单元
begin
  // 显示jpg大图片的方式
  jpg := TJPEGImage.Create;
  jpg.LoadFromFile(getcurrentdir() + ‘\pic.jpg’,’,’,’);
  Image1.Picture.Bitmap.Assign(jpg,’,’,’); // 因为 img 控件是基于bmp的
  jpg.Free;
end;
procedure TForm1.Button2Click(Sender: TObject,’,’,’);
begin
  // 加载24位高清BMP图片(小、大都能成立)
  Image1.Picture.Bitmap.LoadFromFile(getcurrentdir() + ‘\pic24位-大.bmp’,’,’,’);
end;
procedure TForm1.Button3Click(Sender: TObject,’,’,’);
var
  png: tpngimage;
begin
  png := tpngimage.Create;
  png.LoadFromFile(getcurrentdir() + ‘\pic.png’,’,’,’);
  Image1.Picture.Bitmap.Assign(png,’,’,’);
  png.Free;
end;
procedure TForm1.Button4Click(Sender: TObject,’,’,’);
var
  gif: tgifimage;
begin
  gif := tgifimage.Create;
  gif.LoadFromFile(getcurrentdir() + ‘\pic.png’,’,’,’);
  Image1.Picture.Bitmap.Assign(gif,’,’,’);
  gif.Free;
end;

unit Unit1;

interface

interface

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

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

type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
end;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
  end;

var
Form1: TForm1;

var
  Form1: TForm1;

implementation

implementation

{$R *.dfm}

{$R *.dfm}

uses jpeg, GIFImg, pngimage;

//TStringBuilder.Append 可以添加几乎所有数据类型, 甚至是对象
procedure TForm1.Button1Click(Sender: TObject);
var
  sb1,sb2: TStringBuilder;
  ver: Cardinal;
begin
  sb1 := TStringBuilder.Create;
  sb2 := TStringBuilder.Create;

Author

发表评论

电子邮件地址不会被公开。 必填项已用*标注