如何在不使用 F#/C# 的 WinForms 的情况下将像素绘制到屏幕上?

How can I plot pixels onto the screen without WinForms using F#/C#?

我想知道如何获取和设置当前显示在屏幕上的像素,我确信这一定可行,只是不知道如何操作。我需要使用 DLL 吗?此时我没有任何代码可以展示,但我只需要指出正确的方向,如果你只能用 C# 回答,我可以在大多数情况下从 C# 移植到 F#。

看这道题: 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);
}