Thank you for your question.
I found a vb6 to vb.net translator provided by
http://www.tradukki.com/[
^]
and they provided this :
Private Const W As Long = 4
Private Const H As Long = 4
Private Row As Long
Private Col As Long
Private vLeft As Integer
Private vTop As Integer
Private Cols As Long
Private Rows As Long
Private indx As Long
Sub Create_matrix()
Rows = picturebox1.Height \ (H - 1)
Cols = picturebox1.Width \ (W - 1)
Home(0).Visible = True
vLeft = 0
vTop = 0
For i = 0 To Home.Count
On Error Resume Next
Me.Controls.Remove(Home(i))
Next i
For Row = 1 To Rows
For Col = 1 To Cols
indx = (Row - 1) * Cols + Col
Me.Controls.Add(Home(indx))
Home(indx).Location = New Point(vLeft, vTop)
Home(indx).Size = New Point(W, H)
Home(indx).Visible = True
vLeft = vLeft + W - 1
Next Col
vLeft = 0
vTop = vTop + H - 1
Label1.Text = "[" & Col & " ," & Row & " ]"
Next Row
For Index = 1 To Home.Count
Xx = Home(Index).Left + Home(Index).Width / 2
Yy = Home(Index).Top + Home(Index).Height / 2
If GetPixel(picturebox1, Xx, Yy) <> Blank Then
Home(Index).BackColor = GetPixel(picturebox1, Xx, Yy)
Else
Home(Index).BackColor = Blank
End If
Next Index
End Sub
Private Function GetPixel(ByVal picture As PictureBox, ByVal x As Integer, ByVal y As Integer)
Dim bitmap As Bitmap = picture.Image
Return bitmap.GetPixel(x, y)
End Function
Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click
Label2_Click()
End Sub
Sub Label2_Click()
Listbox1.Items.Clear()
Dim X As Integer
Dim Y As Integer
Dim Index As Integer
Dim Blank As Color
Blank = GetPixel(picturebox1, 0, 0)
For Index = 1 To Home.Count
X = Home(Index).Left + Home(Index).Width / 2
Y = Home(Index).Top + Home(Index).Height / 2
If GetPixel(picturebox1, X, Y) <> Blank Then
Listbox1.Items.Add("[" & X & " ," & Y & " ]")
Else
Text = Text & "0"
End If
Next Index
End Sub
Private Sub ClearPicture_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearPicture.Click
ClearPicture_Click()
End Sub
Sub ClearPicture_Click()
picturebox1.Image = Nothing
Listbox1.Items.Clear()
End Sub
Private Sub LoadPicture_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoadPicture.Click
LoadPicture_Click()
End Sub
Sub LoadPicture_Click()
Dim strFileName As String
With commondialogcontrol1
.Filter = "JPEG (*.jpg)|*.jpg"
.Title = "Picture Search"
.InitialDirectory = "C:\"
On Error GoTo NoFileOpened
.ShowDialog()
strFileName = .FileName
NoFileOpened:
End With
picturebox1.Image = New Bitmap(strFileName)
End Sub
Is it what you were looking for ?