`
sugongqing
  • 浏览: 77307 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

VB Image

阅读更多

Private Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
Dim a As String, k As Single
Private Type BITMAP
    bmType As Long
    bmWidth As Long
    bmHeight As Long
    bmWidthBytes As Long
    bmPlanes As Integer
    bmBitsPixel As Integer
    bmBits As Long
End Type

Private Type PicInfo
    PicWidth As Long
    picHeight As Long
End Type

Private Function fncGetInfo(lsPicName As String) As PicInfo
'lsPicName是图片的文件名,带路径
    Dim hBitmap As Long
    Dim res As Long
    Dim bmp As BITMAP
    res = GetObject(LoadPicture(lsPicName).Handle, Len(bmp), bmp) '取得BITMAP的结构
    fncGetInfo.PicWidth = bmp.bmWidth  '图片的宽
    fncGetInfo.picHeight = bmp.bmHeight '图片的高
End Function

引用:
   Print fncGetInfo("c:\景色1.jpg").PicWidth
   Print fncGetInfo("c:\景色1.jpg").picHeight

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics