我在picturebox里面画条线,我想找到这个picturbox里面像素点颜色值??
大概意思,我知道,通过两个循环,内外循环找!这个picturebox里面的图片只有两种颜色,一白一红,白色是背景,红色是线的颜色,红色找到之后记做1,白色记做0,最终我想得到一个500x500的矩阵,这个矩阵只有1和0组成!这是我编的代码,可是总是报错,请好心人帮我看一眼,哪里出了问题呢?????Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim i, j As Integer
Dim tmpbmp As New Bitmap(PictureBox2.Image)
PictureBox2.Image = tmpbmp
With tmpbmp
For j = 1 To .Height
For i = 1 To .Width
Dim p As Color
p = tmpbmp.GetPixel(i, j)
If 255 - p.R = RGB(255, 0, 0) Then
A(i, j) = 1
ListBox1.Items.Add(A(i, j))
'Else
'A(i, j) = 0
End If
Next
Next
End With
End Sub