首先获得一个图片对象
1 Dim spic As StdPicture2 Set spic = LoadPicture("d:\0.bmp") '从文件获得3 Set spic = Clipboard.GetData '从粘贴板获得
方法一:
Dim w As Long, h As Longw = spic.Width/ 26.4591 h = spic.Height/ 26.4591
方法二:
Dim w As Long, h As Longw = ScaleX(spic.Width, vbHimetric, vbPixels)h = ScaleY(spic.Height, vbHimetric, vbPixels)
方法三:
'声明APIPrivate Declare Function GdiGetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As LongPrivate Type BITMAP '14 bytes bmType As Long bmWidth As Long bmHeight As Long bmWidthBytes As Long bmPlanes As Integer bmBitsPixel As Integer bmBits As LongEnd Type'过程中Dim w As Long, h As Long,bmp As BITMAPGdiGetObject spic, Len(bmp), bmpw = bmp.bmWidthh = bmp.bmHeight