Article View: cn.bbs.comp.program
Article #727���delphi�е�API��������
From: ���������
Date: Fri, 12 Jun 1998 00:00
Date: Fri, 12 Jun 1998 00:00
81 lines
2977 bytes
2977 bytes
�����Լ�д�Ŀؼ�������windows��APIΪ�˼ӿ��ͼ�ٶȡ�����ֵ���
ÿ���½����̼����ҵĿؼ����ж����һ���˳�����open�������
�ͳ���out of system resources�Ĵ����Ҳ��ܴ��̣�����д�ļ���
��֪��ʲô�ط������⣬ԭ��������:
constructor TAIScrollimage.Create(Aowner:Tcomponent);
begin
inherited Create(Aowner);
Fbitmap:=Tbitmap.Create;
bitmap:=Tbitmap.Create;
CurrentLeft:=0;
currentTop:=0;
width:=40;
height:=40;
end;
procedure TAIScrollimage.paint;
var ret:integer;
begin
bitblt(canvas.handle,0,0,width,height,hdcCopy,Currentleft,CurrentTop,SRCCOPY);
end;
procedure TAIScrollimage.loaded;
begin
HdcCopy:=CreateCompatibleDC(canvas.Handle);
Hbitmapbackup:=selectobject(hdcCopy,Fbitmap.Handle);
end;
procedure TAIScrollimage.mousemove(Shift: TShiftState; X, Y: Integer);
begin
if (0<y)and(y<FScrollRange) then
begin
if(currentTop-10>0) then begin CurrentTop:=currentTop-10;
bitblt(canvas.handle,0,0,width,height,hdcCopy,Currentleft,CurrentTop,SRCCOPY);
end
else begin CurrentTop:=0;//invalidate;
end;
exit;
end;
if (0<x)and(x<FScrollRAnge) then
begin
if (currentLeft-10>0) then begin currentLeft:=CurrentLeft-10;
bitblt(canvas.handle,0,0,width,height,hdcCopy,Currentleft,CurrentTop,SRCCOPY);
end
else begin CurrentLeft:=0;//invalidate;
end;
exit;
end;
if (width-x>0)and(width-x<FScrollRange) then
begin
if(currentLeft+width+10<Fbitmap.Width) then begin CurrentLeft:=CurrentLeft+10;
bitblt(canvas.handle,0,0,width,height,hdcCopy,Currentleft,CurrentTop,SRCCOPY);
end
else begin Currentleft:=Fbitmap.width-width;//invalidate;
end;
exit;
end;
if(height-y>0)and(height-y<FScrollRange) then
begin
if(CurrentTop+height+10<Fbitmap.Height) then begin CurrentTop:=CurrentTop+10;
bitblt(canvas.handle,0,0,width,height,hdcCopy,Currentleft,CurrentTop,SRCCOPY);
end
else begin CurrentTop:=Fbitmap.Height-height;//invalidate;
end;
exit;
end;
end;
destructor TAIScrollimage.destroy;
var ret:integer;
r:longbool;
begin
ret:=selectobject(hdccopy,Hbitmapbackup);
// ret:=releaseDc(handle,hdccopy);
r:=deleteDc(hdccopy);
Fbitmap.free;
// bitmap.free;
inherited destroy;
end;
--
�� ��Դ: �й�ƴ�BBSվ [bbs.ustc.edu.cn]
Technical Details
Message-ID:
<980612.ykP4r$PBBS@bbs.ustc.edu.cn>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: Chinese,GB X-Google-Thread: fc86e,601eebaa24a39e5,start X-Google-Attributes: gidfc86e,public From: Rain_Days@bbs.ustc.edu.cn (���������) Subject: ���delphi�е�API�������� Date: 1998/06/12 Message-ID: <980612.ykP4r$PBBS@bbs.ustc.edu.cn> X-Deja-AN: 362050687 Organization: �й�ƴ�BBSվ Newsgroups: cn.bbs.comp.program