Hallo,
This is a bit of a knotty one, but I really would like to get it to work.
I want to write to the PictureData property of an image control on a form, but it seems to be read only.
I have written two routines to read/write a byte of data:
I have written a test harness to try it out using an array of bytes and the PictureData property of an image control:
As you can see, this outputs byte 0 of the PictureData and the byte array.
Then it attempts to set byte 0 of the PictureData and the byte array.
Lastly it re-outputs the same bytes as before which I would expect to have the changed values.
Unfortunately, while the byte array code works, the PictureData one doesn't.
I can copy the PictureData into a byte array, change it and copy the byte array back and the PictureData is updated.
Any ideas why the PictureData is sometimes read-only?
- Frink
This is a bit of a knotty one, but I really would like to get it to work.
I want to write to the PictureData property of an image control on a form, but it seems to be read only.
I have written two routines to read/write a byte of data:
Code:
Public Sub WriteByte(pvarBitmap, ByVal plngByteOffset As Long, ByVal pbytValue As Byte)
pvarBitmap(plngByteOffset) = pbytValue
End Sub
Public Function bytReadByte(pvarBitmap, ByVal plngByteOffset As Long) As Byte
bytReadByte = pvarBitmap(plngByteOffset)
End Function
I have written a test harness to try it out using an array of bytes and the PictureData property of an image control:
Code:
Dim bytArray(0 To 99) As Byte
MsgBox bytReadByte(Me!imgImage1.PictureData, 0) & " " & bytReadByte(bytArray, 0)
WriteByte Me!imgImage1.PictureData, 0, 39
WriteByte bytArray, 0, 39
MsgBox bytReadByte(Me!imgImage1.PictureData, 0) & " " & bytReadByte(bytArray, 0)
As you can see, this outputs byte 0 of the PictureData and the byte array.
Then it attempts to set byte 0 of the PictureData and the byte array.
Lastly it re-outputs the same bytes as before which I would expect to have the changed values.
Unfortunately, while the byte array code works, the PictureData one doesn't.
I can copy the PictureData into a byte array, change it and copy the byte array back and the PictureData is updated.
Any ideas why the PictureData is sometimes read-only?
- Frink