Hi Marc
Quote:
but I don't know how to "transform" the pixel in a byte. I hope you can help me
Sorry for my poor english, i'am German
I hope i can help you. Please check this
Code:
Public Function PixelToHex(cntrl As Control, xoff As Long, yoff As Long, Width As Long, Height As Long) As String
Dim B() As Byte
Dim hdc As Long
Dim xi As Long
Dim exp As Long
Dim x As Long
Dim Y As Long
Dim cnt As Long
Dim pix As Long
Dim hx$
Dim hexx$
' die Breite, width, wird hier in Pixel angegeben, nicht in Byte.
ReDim B(Width * Height)
hdc = cntrl.hdc
cnt = 0
For Y = 0 To Height - 1
For x = 0 To Width - 1 Step 8
cnt = cnt + 1
For xi = 0 To 7
'pix = GetPixel(hdc, xoff + x + xi, yoff + y)
pix = cntrl.Point(xoff + x + xi, yoff + Y)
If pix = 0 Then
exp = 7 - xi
B(cnt) = B(cnt) Or 2 ^ exp
End If
Next xi
Next x
Next Y
'Bis hierhin in Byte
'Nun nach Hex Konvertieren
For x = 1 To cnt
hx$ = Hex$(B(x))
If Len(hx$) = 1 Then
hx$ = "0" + hx$
End If
hexx$ = hexx$ + hx$
Next x
PixelToHex = hexx$
End Function
I hope that is what you will
Run the code with fellow Function
Code:
Dim H$
H$ = PixelToHex(Picture1, 0, 0, 240, 128)
You can translate it for your work! when you not will use "HEX"
Greetings Emil
PS: I hope you can help me out with your MODUL of T6963C