7,763
社区成员
发帖
与我相关
我的任务
分享
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
Const MERGEPAINT = &HBB0226
Const SRCAND = &H8800C6
Const SRCCOPY = &HCC0020
Dim Ss As Integer
Private Sub Form_Load()
Picture2.Picture = LoadPicture("c:\1.JPG")
End Sub
Private Sub Command1_Click()
BitBlt Picture1.hdc, 0, 0, 48, 48, Picture2.hdc, 0, 0, SRCAND
Picture1.Refresh
Dim PBag As New PropertyBag
Dim B() As Byte
PBag.WriteProperty "Picture", Picture1.Image
B = PBag.Contents '获取容器Byte 到 B() 数组中
Ss = FreeFile
Open App.Path & "\1.dat" For Binary As Ss
Put Ss, , B
Close Ss
End Sub
Private Sub Command2_Click()
Dim PBag As New PropertyBag
Dim B() As Byte
Ss = FreeFile
Open App.Path & "\1.dat" For Binary As Ss
ReDim B(LOF(Ss))
Get Ss, , B
Close Ss
PBag.Contents = B '指定 PBag容器的内容
'读取容器中的图片
Set Picture1.Picture = PBag.ReadProperty("Picture")
Picture1.Refresh
End Sub