p; FileName="C:\SAMP.BMP"
Open FileName For Binary As #1
Get #1,19,ImageWidth:Get#1,,ImageHeight ''读取位图的宽度和高度
Close #1
DW=15*ImageWidth-ImageWin.Width ''将像点转换为Twip(微点)
DH=15*ImageHeight-ImageWin.Height
ImageWin.Width=15*ImageWidth
ImageWin.Height=15*ImageHeight
AppImage.Autoredraw=True
AppImage.Caption=FileName ''改变Form窗标题
HScroll1.SmallChange=100 ''设置滚动最小步距
VScroll1.SmallChange=100
DX=ImageWin.Width:DY=ImageWin.Height ''设置复制图像尺寸
SX=ImageWin.Width:SY=ImageWin.Height
AMP=1''设置缩放比例为1
sWin=GetDesktopWindow() ''获取桌面窗口句柄
sDC=GetDC(sWin) ''转换为描述表句柄
hd=BitBlt(ImageWin.hdc,0,0,Image.Width,Image.Height,sDC,0,0,&HCC0020)
hd=ReleaseDC(sWin,sDC) ''释放窗口描述表
AppImage.ImageWin=LoadPicture(FileName) ''载入图像显示
End Sub
3.在General对象的Declaration过程中声明本程序所使用的WIN95 API函数和和过程,以及各事件
程序所使用的全局变量等。
Private Declare Function BitBlt Lib "gdi32"(ByVal hDestDC As Long,ByVal X As Long,ByVal Y As Long,ByVal nWidth As Long,ByVal nHeight As Long,ByVal hSrcDC As Long,ByVal xSrc As Long,ByVal ySrc As Long,ByVal dwRop As Long) As Long
Private Declare Function GetDC Lib "