L
LEYT8
Unregistered / Unconfirmed
GUEST, unregistred user!
下面的程序已编译通过,但就是无法显示图片,不知是何原因?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
Bitmap: TBitmap;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
var
x, y: Integer;
MyRect, MyOther: TRect;
begin
try
x:=0;y:=0;
MyRect := Rect(0,0,100,100);
MyOther := Rect(0,0,100, 100);
Bitmap := TBitmap.Create;
Form1.Canvas.CopyMode:=cmblackness;
Bitmap.LoadFromFile('F:/scr2/mid/2.bmp');
Form1.Canvas.BrushCopy(MyRect,Bitmap, MyRect, clBlack);
Form1.Canvas.CopyRect(MyOther,Bitmap.Canvas,MyRect);
Form1.Canvas.stretchdraw(MyRect,Bitmap);
Canvas.Draw(x, y, Bitmap);
finally
Bitmap.Free;
end;
end;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
Bitmap: TBitmap;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
var
x, y: Integer;
MyRect, MyOther: TRect;
begin
try
x:=0;y:=0;
MyRect := Rect(0,0,100,100);
MyOther := Rect(0,0,100, 100);
Bitmap := TBitmap.Create;
Form1.Canvas.CopyMode:=cmblackness;
Bitmap.LoadFromFile('F:/scr2/mid/2.bmp');
Form1.Canvas.BrushCopy(MyRect,Bitmap, MyRect, clBlack);
Form1.Canvas.CopyRect(MyOther,Bitmap.Canvas,MyRect);
Form1.Canvas.stretchdraw(MyRect,Bitmap);
Canvas.Draw(x, y, Bitmap);
finally
Bitmap.Free;
end;
end;
end.