Color of a screen pixel: Difference between revisions

Don't copy entire screen (thanks to F# example)
(Don't copy entire screen (thanks to F# example))
Line 20:
int h = Screen.PrimaryScreen.Bounds.Height;
 
Bitmap img = new Bitmap(w1, h1);
Graphics g = Graphics.FromImage(img);
g.CopyFromScreen(new Point(0x, 0y), new Point(0, 0), new Size(w1, h1));
 
Color color = img.GetPixel(x, y);</lang>
 
=={{header|F_Sharp|F#}}==
The C# example copies the entire screen into our private bitmap but that's unnecessary. All we need is the single pixel. Also, it doesn't appear that the bitmap and graphics object are being disposed of there. Other than that, this is essentially identical to that solution.
Anonymous user