A
ambush
Unregistered / Unconfirmed
GUEST, unregistred user!
这两个图片都是800*600的,可以给出关键源码吗?
以下是我写的测试代码,在一个新建的应用中,在FORM上布置3个button,3个image,1个OpenPictureDialog。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,Jpeg, StdCtrls, ExtCtrls, ExtDlgs;
type
TForm1 = class(TForm)
Button1: TButton;//加载jpg1
Button2: TButton;//加载jpg2
Button3: TButton;//拼接jpg1,jpg2到jpg3
Button4: TButton;//释放jpg1,jpg2,jpg3
Image1: TImage;//显示jpg2
Image2: TImage;//显示jpg2
Image3: TImage;//显示jpg1,jpg2拼接后得到jpg3
OpenPictureDialog1: TOpenPictureDialog;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
m_Jpg1,m_Jpg2,m_Jpg3:TJpegImage;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
//加载并显示jpg1
self.m_Jpg1:=TJpegImage.Create;
if self.OpenPictureDialog1.Execute then
begin
self.m_Jpg1:=TJpegImage.Create;
self.m_Jpg1.LoadFromFile(self.OpenPictureDialog1.FileName);
self.Image1.Picture.LoadFromFile(self.OpenPictureDialog1.FileName);
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
//加载并显示jpg2
self.m_Jpg2:=TJpegImage.Create;
if self.OpenPictureDialog1.Execute then
begin
self.m_Jpg2:=TJpegImage.Create;
self.m_Jpg2.LoadFromFile(self.OpenPictureDialog1.FileName);
self.Image2.Picture.LoadFromFile(self.OpenPictureDialog1.FileName);
end;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
//释放jpg1,jpg2,jpg3
self.m_Jpg1.Free;
self.m_Jpg2.Free;
self.m_Jpg3.Free;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
//拼接jpg1,jpg2到jpg3并显示jpg3
self.m_Jpg3:=TJpegImage.Create;
{
如何做?哪位大侠帮助补齐!
}
end;
end.
以下是我写的测试代码,在一个新建的应用中,在FORM上布置3个button,3个image,1个OpenPictureDialog。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,Jpeg, StdCtrls, ExtCtrls, ExtDlgs;
type
TForm1 = class(TForm)
Button1: TButton;//加载jpg1
Button2: TButton;//加载jpg2
Button3: TButton;//拼接jpg1,jpg2到jpg3
Button4: TButton;//释放jpg1,jpg2,jpg3
Image1: TImage;//显示jpg2
Image2: TImage;//显示jpg2
Image3: TImage;//显示jpg1,jpg2拼接后得到jpg3
OpenPictureDialog1: TOpenPictureDialog;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
m_Jpg1,m_Jpg2,m_Jpg3:TJpegImage;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
//加载并显示jpg1
self.m_Jpg1:=TJpegImage.Create;
if self.OpenPictureDialog1.Execute then
begin
self.m_Jpg1:=TJpegImage.Create;
self.m_Jpg1.LoadFromFile(self.OpenPictureDialog1.FileName);
self.Image1.Picture.LoadFromFile(self.OpenPictureDialog1.FileName);
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
//加载并显示jpg2
self.m_Jpg2:=TJpegImage.Create;
if self.OpenPictureDialog1.Execute then
begin
self.m_Jpg2:=TJpegImage.Create;
self.m_Jpg2.LoadFromFile(self.OpenPictureDialog1.FileName);
self.Image2.Picture.LoadFromFile(self.OpenPictureDialog1.FileName);
end;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
//释放jpg1,jpg2,jpg3
self.m_Jpg1.Free;
self.m_Jpg2.Free;
self.m_Jpg3.Free;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
//拼接jpg1,jpg2到jpg3并显示jpg3
self.m_Jpg3:=TJpegImage.Create;
{
如何做?哪位大侠帮助补齐!
}
end;
end.