oneeye
asked on
Displaying Jpeg images in a form
Good day all,
Could someone put up a code fragment for grabbing and displaying a jpeg on a form? The reference to where the file is could be a field in a database, or a BLOB. (Well, actually, those are the same things.) I'm pretty much just looking to display some jpegs on a form, though.
I'll be poking around Tjpeg this evening...
Oneeye
Could someone put up a code fragment for grabbing and displaying a jpeg on a form? The reference to where the file is could be a field in a database, or a BLOB. (Well, actually, those are the same things.) I'm pretty much just looking to display some jpegs on a form, though.
I'll be poking around Tjpeg this evening...
Oneeye
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ah, thanks both of you. In combination with the example in the delphi help, that gives me a pretty good handle on it...
Oneeye
Oneeye
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,JPEG;
type
TForm1 = class(TForm)
procedure FormClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormClick(Sender: TObject);
var JPG: TjpegImage;
begin
if FileExists('c:\a.jpg') then begin
JPG := TJpegImage.Create;
try
JPG.LoadFromFile('c:\a.jpg
Canvas.Draw(0,0, JPG);
finally
JPG.Free;
end;
end;
end;
end.
try this, ( you have to double click on the OnClick event of the form on the object inspector ).
then run it, click on the form, and there you have it !
bryan