I am a beginner with coding and trying to solve simple problem:
I have list with three columns and trying to access values stored in the list. And it gives me no answer... any idea? thanks
private void btnImage1Load_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
pictureBox1.ImageLocation = openFileDialog1.FileName;
}
public class ListThreeColumns
{
public int XCoord { get; set; }
public int YCoord { get; set; }
public Color Color { get; set; }
}
private List<ListThreeColumns> GetPixels()
{
Bitmap picture = new Bitmap(pictureBox1.Image);
List<ListThreeColumns> colorList = new List<ListThreeColumns>
{
};
for (int y = 0; y < picture.Height; y++)
{
for (int x = 0; x < picture.Width; x++)
{
colorList.Add(new ListThreeColumns { XCoord = x, YCoord = y, Color = picture.GetPixel(x, y) });
}
}
return colorList;
}
private void btnScanPixels_Click(object sender, EventArgs e)
{
List<ListThreeColumns> seznamBarev = GetPixels();
MessageBox.Show(seznamBarev[6].ToString());
}