C#用 Bitmap的GetPixel
去取像點的顏色
http://msdn.microsoft.com/zh-tw/library/system.drawing.bitmap.getpixel.aspx
但是
畫面無法直接轉成Bitmap
所以要透過Graphics的CopyFromScreen先去抓圖
http://msdn.microsoft.com/zh-tw/library/6yfzc507.aspx
//大概這樣? 沒試過, 你自己試
public Color GetPixelFromScreen(int x, int y)
{
int width = 1;
int height = 1;
Bitmap img = new Bitmap(width, height, PixelFormat.Format24bppRgb);
using (Graphics g = Graphics.FromImage(img))
{
g.CopyFromScreen(
new Point(x, y),
new Point(0, 0),
new Size(width, height));
}
return img.GetPixel(0,0);
}