程序找错!(菜鸟级)(100分)

  • 主题发起人 主题发起人 ANTIDEAD
  • 开始时间 开始时间
A

ANTIDEAD

Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;

interface

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

type


TForm1 = class(TForm)
private
procedure drawtransparent(thandle:hdc;x,y:integer;s:tbitmap;trcol:tcolor);

protected
Image1: TImage;

procedure FormActivate(Sender: TObject);


{ Private declarations }

public

{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormActivate(Sender: TObject);
begin
drawtransparent(canvas.handle,image1.width,0,image1.picture.bitmap,clblack);
end;


procedure drawtransparent(thandle:hdc;x,y:integer;s:tbitmap;trcol:tcolor);
var
bmpxor,bmpand,bmpinvand,bmptarget:tbitmap;
oldcol:longint;
begin
try
bmpand:=tbitmap.create;
bmpand.width:=S.width;
bmpand.height:=s.height;
bmpand.monochrome:=true;
oldcol:=setbkcolor(s.canvas.handle,colortorgb(trcol));
bitblt(bmpand.Canvas.handle,0,0,s.width,s.height,s.canvas.handle,0,0,srccopy);
setbkcolor(s.canvas.handle,oldcol);
bmpinvand:=tbitmap.create;
bmpinvand.width:=S.width;
bmpinvand.height:=s.height;
bmpand.monochrome:=true;
bitblt(bmpinvand.Canvas.handle,0,0,s.width,s.height,bmpand.canvas.handle,0,0,notsrccopy);

bmpxor:=tbitmap.create;
bmpxor.width:=S.width;
bmpxor.height:=s.height;
bitblt(bmpxor.Canvas.handle,0,0,s.width,s.height,bmpinvand.canvas.handle,0,0,srccopy);
bitblt(bmpxor.Canvas.handle,0,0,s.width,s.height,bmpinvand.canvas.handle,0,0,srcand);

bmptarget:=tbitmap.create;
bmptarget.width:=S.width;
bmptarget.height:=s.height;
bitblt(bmptarget.Canvas.handle,0,0,s.width,s.height,thandle,0,0,srccopy);
bitblt(bmptarget.Canvas.handle,0,0,s.width,s.height,bmpand.canvas.handle,0,0,srcand);
bitblt(bmptarget.Canvas.handle,0,0,s.width,s.height,bmpxor.canvas.handle,0,0,srcinvert);
bitblt(thandle,x,y,s.width,s.height,bmptarget.canvas.handle,0,0,srccopy);
finally
bmpxor.free;
bmpand.free;
bmpinvand.free;
bmptarget.free;
end;
end;


end.
怎样解决!
 
你这人真是的,
你的问题都没有提出来,你光叫别人看你的代码,谁会有这闲功夫呀?
 
什么问题?
 
d5编译不能通过,出现“unsatified forward or external.......",怎样才能编译通过。
 
procedure drawtransparent(thandle:hdc;x,y:integer;s:tbitmap;trcol:tcolor);
这句有错,
改为

procedure Tform1.drawtransparent(thandle:hdc;x,y:integer;s:tbitmap;trcol:tcolor);
 
是的

实现部分要加上类名!

把光标放到声明部分procedure drawtransparent(thandle:hdc;x,y:integer;s:tbitmap;trcol:tcolor);

按住shift+ctrl+C 就可以自动补全了!
 
同意楼上的说法, 应该在过程名前加上类名!
真是的, 还to:ANTIDEAD, 你这样学习程序的方法不行! 一点小问题都来!?
分拿来算了!
 
多人接受答案了。
 
后退
顶部