'運行前先在窗體上放一Picturebox Option Explicit
Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
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 Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
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 Sub Command1_Click()
Dim hdc As Long
Dim pic As Picture
Dim hBitmap As Long
Dim bm As BITMAP
Set pic = LoadPicture("c:\ecm.bmp")
Set Picture1.Picture = pic
GetObject pic.Handle, Len(bm), bm
hdc = CreateCompatibleDC(Me.hdc)
hBitmap = CreateCompatibleBitmap(me.hDc, bm.bmWidth, bm.bmHeight)
SelectObject hdc, hBitmap
BitBlt hdc, 0, 0, bm.bmWidth, bm.bmHeight, Picture1.hdc, 0, 0, vbSrcCopy
End Sub
Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
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 Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
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 Sub Command1_Click()
Dim hdc As Long
Dim pic As Picture
Dim hBitmap As Long
Dim bm As BITMAP
Set pic = LoadPicture("c:\ecm.bmp")
Set Picture1.Picture = pic
GetObject pic.Handle, Len(bm), bm
hdc = CreateCompatibleDC(Me.hdc)
hBitmap = CreateCompatibleBitmap(me.hDc, bm.bmWidth, bm.bmHeight)
SelectObject hdc, hBitmap
BitBlt hdc, 0, 0, bm.bmWidth, bm.bmHeight, Picture1.hdc, 0, 0, vbSrcCopy
End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货