Winform中怎么取到窗体中某一像素点的颜色代码

如题所述

要使用GetPixel函数来取得像素的颜色值,代码如下:

1
2
3
4
5

private void button1_Click(object sender, EventArgs e)
{
Color color = new Bitmap(pictureBox1.Image).GetPixel(10, 10);
MessageBox.Show(color.ToString());
}

效果见下图:
温馨提示:答案为网友推荐,仅供参考