r/visualbasic • u/Technical-Garage-310 • Aug 03 '24
VB.NET Help Hey guys need help again
In my last post I have mentioned I need help of dragging and dropping however with some help I got that but now for the game I need to score as user gets right but since I am comparing pictures I cannot solve it also I cannot find any code Internet can anyone help me here is my code
Private Sub btnCheck_Click(sender As Object, e As EventArgs) Handles btnCheck.Click
Dim score As Integer = 0
If PBs.Image Is PB1.Image Then
score += 1
ElseIf pbD2 Is PB2 Then
score += 1
ElseIf pbD3 Is PB3 Then
score += 1
End If
MsgBox("score " & score)
End Sub
so I have created 3 picture box(which contains the pictures) and another 3 (where the user need to drop that image) also I have created a check button to show the result
I am knew to VB.net
View all comments
Show parent comment
2
u/veryabnormal Aug 03 '24
GetPixel Is very slow. You can speed it up a few hundred thousand times with LockBits, but it gets complicated and there might be a better way to do it nowadays within the framework. If you know the image format then using lockbits allows you to freeze the memory that holds the image and then copy it into and array which can be scanned much more quickly. GetPixel is going to make thousands of windows API calls, lockbits will just make a couple of calls. I’ll do a quick example.