int i,i1,dx,dy,pixelwidth,pixelheight,xz,yz,div,mode
uint hdc,hpicture
ulong scrcopy,hmdc
string picname
div=8//图片描绘的次数
mode=16//代表从指定的文件装入图片
p_2.picturename=""
picname=trim(sle_1.text)//sle_1.text中为要显示的图片的文件名
scrcopy=13369376//代表图片转移时的操作方式为覆盖
pixelwidth=UnitsToPixels(p_2.width,XUnitsToPixels!)//将picture控件在pb下的宽度转换为以象素为单位的宽度
pixelheight=UnitsToPixels(p_2.height,yUnitsToPixels!)// 将picture控件在pb下的高度转换为以象素为单位的高度
dx=pixelwidth/div
dy=pixelheight/div
hdc=GetDC(handle(p_2))//取得p_2控件的DC
hpicture=LoadImageA(0,picname,0,pixelwidth,pixelheight,mode)//将图片以宽度pixelwidth高度pixelheight的尺寸装入内存
hmdc=CreateCompatibleDC(hdc)//创建与hdc兼容的内存设备描述表hmdc
SelectObject(hmdc,hpicture)//将位图对象选入hmdc
for i=1 to div
xz=0
yz=0
StretchBlt(hdc,xz,yz,dx*i,dy*i,hmdc,0,0,pixelwidth,pixelheight,scrcopy)//将左上角坐标为〔0,0〕,宽度为pixelwidth,高度为pixelheight的hmdc的图象转移到左上角坐标为〔xz,yz〕宽度为dx*I, 高度为dy*I的hdc中
for i1=1 to 20000//用于延迟时间
next
next
ReleaseDC(0,hdc)
DeleteDC(hmdc)
DeleteObject(hpicture)