Public Function ReadByteFile( _ ByVal strFile As String) As Variant Dim byteFile() As Byte Open strFile For Binary As #1 If (LOF(1) = 0) Then Close #1 ReadByteFile = 0 Exit Function End If ReDim byteFile(LOF(1)) Get #1, 1, byteFile Close #1 ReadByteFile = byteFile End Function直接把这个函数的返回值保存到字段中就行了!
搞错了, 这个才对Public sub CreateFile(ByRef bFile() As Byte,byval strFile as string) On Error GoTo Err1 Open strFile For Binary As #1 Put #1, , bFile Close #1 Err1: End sub
然后用
MSHFlexGrid1.Row = 1
MSHFlexGrid1.Col = 1
Set MSHFlexGrid1.CellPicture = _
LoadPicture("Icons\Computer\Trash02a.ico")
来显示image的内容,不过一般来说会影响速度,不建议使用!
谢谢
ByVal strFile As String) As Variant
Dim byteFile() As Byte
Open strFile For Binary As #1
If (LOF(1) = 0) Then
Close #1
ReadByteFile = 0
Exit Function
End If
ReDim byteFile(LOF(1))
Get #1, 1, byteFile
Close #1
ReadByteFile = byteFile
End Function直接把这个函数的返回值保存到字段中就行了!
这个才对Public sub CreateFile(ByRef bFile() As Byte,byval strFile as string)
On Error GoTo Err1 Open strFile For Binary As #1
Put #1, , bFile
Close #1
Err1:
End sub