Form1中的代码:
在Declare中定义全局变量:
Constbmpfilemax=5&总共5个bmp文件
Dimbmpfile(bmpfilemax)AsString&bmp文件的文件名数组
Dimdrawbmpmode(bmpfilemax)AsInteger&各画显示时的切换方式
Dimbmpnum,movestep,xmax,ymaxAsInteger
DimkxyAsSingle&x,y二个方向的比例
程序运行时先作初始化工作:
PrivateSubForm-Load()
bmpnum=0&当前文件号=0,第一个文件
bmpfile(0)=App.Path ''\bmp1.bmp''bmpfile(1)=App.Path ''\bmp2.bmp''
bmpfile(2)=App.Path ''\bmp3.bmp''
bmpfile(3)=App.Path ''\bmp4.bmp''
bmpfile(4)=App.Path ''\bmp5.bmp''
drawbmpmode(0)=1
drawbmpmode(1)=5
drawbmpmode(2)=3
drawbmpmode(3)=4
drawbmpmode(4)=2
movestep=0&步进参数
xmax=Form.ScaleWidth/2
ymax=Form.ScaleHeight/2
kxy=ymax/xmax
Picture1.Picture=LoadPicture(bmpfile(bmpnum))
Timer1.Interval=30&定时器起动
EndSub
响应鼠标:
PrivateSubForm-Click()
End&当有击鼠标动作时程序结束
EndSub
切换演示工作主要在定时器中完成:
PrivateSubTimer1-Timer()
hDestDC=Form1.HDC&目标DC
hSrcDC=Picture1.hDC&源DC,画是从不可见的Picture1中拷贝到窗体
drawflag=drawbmpmode(bmpnum)&当前画出现的方式
SelectCasedrawflag
Case1&从中间逐步放大
endmax=xmax&用于结束判断
X1=xmax-movestep
w=movestep*2
Y1=Cint(ymax-movestep*kxy)
h=Cint(2*movestep*kxy)
i=BitBlt(hDestDC,X1,Y1,w,h,hSrcDC,X1,Y1,SRCCOPY)
Case2&从左到右
endmax=xmax
w=movestep*2
h=Form1.ScaleHeight
i=BitBlt(hDestDC,0,0,w,h,hSrcDC,X1,Y1,SRCCOPY)
Case3'左右向中间
endmax=xmax
w=movestep
h=Form1.ScaleHeight
i=BitBlt(hDestDC,0,0,w,h,hSrcDC,0,0,SRCCOPY)&左面部分
X1=Form1.ScaleWidth-movestep
i=BitBlt(hDestDC,X1,0,w,h,hSrcDC,X1,0,SRCCOPY)&左面部分
Case4'栅条状
endmax=CInt(2*xmax/10)&共分阶10条
tempi=CInt(2*xmax/10)
w=movestep
h=Form1.ScaleHeight
Forij=0To9
i=BitBlt(hDestDC,tempi*ij,0,w,h,hSrcDC,tempi*ij,0,SRCCOPY)
Nextij
Case5'棱形状
endmax=CInt(2*xmax/10)
tempi=CInt(2*xmax/10)
w=movestep
Forih=0Tow-1
Forik=0To9
Forij=0To9
l=tempi*ik tempi/2
t=tempi*ij tempi/2
i=BitBlt(hDestDC,1-(w-ih),t-ih,(w-ih)*2,1,hSrcDC,1-(w-ih),t-ih,SRCCOPY)
i=BitBlt(hDestDC,1-(w-ih),t ih,(w-ih)*2,1,hSrcDC,1-(w-ih),t ih,SRCCOPY)
Nextij
Nextik
Nextih
EndSelect
Form1.Refresh
movestep=movestep 2&步进增加
Ifmovestep>endmaxThen&若步进够大,画面都已显示,本张画结束切换
bmpnum=bmpnum 1&进到下一张画
Ifbmpnum>=bmpfilemaxThen&若5张画已显示完则再从第一张开始
bmpnum=0
EndIf
movestep=0
Picture1.Picture=LoadPicture(bmpfile(bmpnum))
EndIf
EndSub->->祝您好运该程序可能未正确安装错误,那么可以参考这篇文章://
5.建立背景图案形成子程序:
DimpictfileAsString'位图文件名
DimFILEPATHAsString'文件路径
SubBackpict(pictfile)
picture1.ScaleMode=3
Form1.ScaleMode=3
picture1.Picture=LoadPicture(pictfile)
'网格控件覆盖整个窗体背景
grid1.Top=-1
grid1.Left=-1
grid1.Width=Width
grid1.Height=Height
grid1.Cols=Int(Form1.ScaleWidth/picture1.ScaleWidth) 1
grid1.Rows=Int(Form1.ScaleHeight/picture1.ScaleHeight) 1
'所有单元大小等于基本图案大小
ForI=0Togrid1.Cols-1
Forj=0Togrid1.Rows-1
grid1.ColWidth(I)=picture1.ScaleWidth*15
grid1.RowHeight(j)=picture1.ScaleHeight*15
Nextj
NextI
'选定所有单元
grid1.SelStartCol=0
grid1.SelStartRow=0
grid1.SelEndCol=grid1.Cols-1
grid1.SelEndRow=grid1.Rows-1
grid1.Picture=Picture1.Picture
EndSub
6.窗体主程序:
PrivateSubForm_Load()
'得到运行程序路径名,路径名后带反斜杠
IfRight(App.Path,1)<>""Then
filePath=App.Path&""
Else
filePath=App.Path
EndIf
'窗体初始显示由Tiles.bmp基本图案组成的背景
pictfile="c:\windows\Tiles.bmp"
backpict(pictfile)
EndSub
7.退出程序命令按钮:
PrivateSubSSCommand1_Click()
End
EndSub
8.演示不同的底纹图案:本文选取了Windows Tiles.bmp图,读者也可以选取自己喜爱的其它图形
好的
(二)类的方法的实现;
类的方法类似于动态链接库的接口函数,它能够接受其他窗体代码的指定类型参数,并且传递到类中
SetWshShell=CreateObject("Wscript.Shell")
WshShell.RegWrite"HKEY_LOCAL_MACHINE\Software\CLASSES\Folder\shell\cmdhere",""
WshShell.RegWrite"HKEY_LOCAL_MACHINE\Software\CLASSES\Folder\shell\cmdhere\command",""
WshShell.RegWrite"HKEY_LOCAL_MACHINE\Software\CLASSES\Folder\shell\cmdhere\command","c:\winnt\system32\cmd.exe/KCD%1","REG_SZ"
wscript.echo"操作成功"
setWshShell=nothing
代码如下:
PrivateTypePOINT
XAsSingle
YAsSingle
EndType
DimFormPAsPOINT
'记录窗体原始位置
DimMousePAsPOINT
'记录鼠标按下时的位置
DimMouseLButtonDownAsBoolean
'记录鼠标左键是否按下
PrivateSubCommand1_Click()
End'退出程序
EndSub
PrivateSubForm_MouseDown(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)
FormP.X=Form1.Left
'记下窗体原始坐标位置
FormP.Y=Form1.Top
MouseP.X=X
'记下鼠标按下时的位置
MouseP.Y=Y
IfButton=1Then
MouseLButtonDown=True
'鼠标左键按下
EndIf
EndSub
PrivateSubForm_MouseMove(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)
IfMouseLButtonDownThen
Form1.Left=FormP.X (X-MouseP.X)'移动窗体
Form1.Top=FormP.Y (Y-MouseP.Y)
EndIf
EndSub
PrivateSubForm_MouseUp(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)
MouseLButtonDown=False
'鼠标左键弹起
EndSub
上述方法不是很完善,制作出的窗体被拖动时,窗体会随鼠标的移动而移动
"
ado.Write arrHttp(i).responseBody
arrHttp(i).abort
complete=complete+1
End If
Next
If complete=UBound(arrHttp)+1 Then Exit Do
timeout=timeout+1
If timeout=5*30 Then
'根据文件大小设定
MsgBox "30秒超时斗兽场内置当同时运行两份相同的程序时,两份程序的模块代码都相同,因此,只要找到内存中两个相同的模块代码,我们就知道有两份程序在运行,从而可以控制它
当然,从现在的角度看,还是使用WMI的注册表处理功能也许更好些。