我想知道如何获取和设置屏幕上当前显示的像素,我敢肯定这是可能的,只是我不知道如何做。我需要使用DLL吗?此时我没有任何代码可显示,但是我只需要指出正确的方向,如果您只能用C#回答,我可以将端口从C#移植到F#。
答案 0 :(得分:2)
看看这个问题: How to read screen pixels for an application that is not in the foreground?
using (Bitmap bmpScreenCapture = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height))
{
using (Graphics g = Graphics.FromImage(bmpScreenCapture))
{
g.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, bmpScreenCapture.Size, CopyPixelOperation.SourceCopy);
}
Color c = bmpScreenCapture.GetPixel(x,y);
}