VB中StdPicture尺⼨(Width,Height)转像素单位⾸先获得⼀个图⽚对象
1Dim spic As StdPicture
2Set spic = LoadPicture("d:\0.bmp") '从⽂件获得
3Set spic = Clipboard.GetData '从粘贴板获得
⽅法⼀:
Dim w As Long, h As Long
w = spic.Width/ 26.4591
h = spic.Height/ 26.4591
⽅法⼆:
Dim w As Long, h As Long
w = ScaleX(spic.Width, vbHimetric, vbPixels)
h = ScaleY(spic.Height, vbHimetric, vbPixels)
⽅法三:
'声明API
Private Declare Function GdiGetObject Lib"gdi32"Alias"GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long Private Type BITMAP '14 bytes
bmType As Long
自学vb推荐书籍bmWidth As Long
bmHeight As Long
bmWidthBytes As Long
bmPlanes As Integer
bmBitsPixel As Integer
bmBits As Long
End Type
'过程中
Dim w As Long, h As Long,bmp As BITMAP
GdiGetObject spic, Len(bmp), bmp
w = bmp.bmWidth
h = bmp.bmHeight
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论