Danny
2005-01-23 23:19:43 UTC
Hi!
I have a really annoying problem. It's from a program I've done in Delphi 5
but now tries to get it working in Delphi 8. I have reproduced the problem
in the following extremly simple program, it has something to do with the
StretchDraw routine. When i run the program and execute the event
(formclick) an error occours:
"Object reference not set to an instance of an object"
Anyone have any ideas what to do. I have spent many hours on the internet
trying to solve that problem, this is my last chance except installing
Delphi 5 again.
Thanks
Daniel
------- The source code for the program that reproduces the error ------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
procedure FormClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.nfm}
procedure TForm1.FormClick(Sender: TObject);
var n:integer;
bild:TPicture;
begin
bild.LoadFromFile('c:\testbild.jpg');
Form1.Canvas.StretchDraw(TRect.Create(1,1,100,150), bild.Graphic);
bild.Free;
end;
end.
I have a really annoying problem. It's from a program I've done in Delphi 5
but now tries to get it working in Delphi 8. I have reproduced the problem
in the following extremly simple program, it has something to do with the
StretchDraw routine. When i run the program and execute the event
(formclick) an error occours:
"Object reference not set to an instance of an object"
Anyone have any ideas what to do. I have spent many hours on the internet
trying to solve that problem, this is my last chance except installing
Delphi 5 again.
Thanks
Daniel
------- The source code for the program that reproduces the error ------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
procedure FormClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.nfm}
procedure TForm1.FormClick(Sender: TObject);
var n:integer;
bild:TPicture;
begin
bild.LoadFromFile('c:\testbild.jpg');
Form1.Canvas.StretchDraw(TRect.Create(1,1,100,150), bild.Graphic);
bild.Free;
end;
end.