Color of a screen pixel: Difference between revisions

added c#
m (→‎{{header|BASIC}}: Doesn't need a function)
(added c#)
Line 1:
{{task|GUI}}Get color information from an arbitrary pixel on the screen, such as the current location of the mouse cursor<br clear=all>
 
=={{header|AutoHotkey}}==
<lang AutoHotkey>
Line 10 ⟶ 11:
}
</lang>
 
=={{header|BASIC}}==
{{works with|QuickBasic|4.5}}
Line 15 ⟶ 17:
In a graphics mode (for instance, <tt>SCREEN 13</tt> or <tt>SCREEN 12</tt>)
<lang qbasic>color = point(x, y)</lang>
 
=={{header|C sharp|C#}}==
 
<lang csharp>
using System;
using System.Drawing;
using System.Windows.Forms;
 
int w = Screen.PrimaryScreen.Bounds.Width;
int h = Screen.PrimaryScreen.Bounds.Height;
 
Bitmap img = new Bitmap(w, h);
Graphics g = Graphics.FromImage(img);
g.CopyFromScreen(new Point(0, 0), new Point(0, 0), new Size(w, h));
 
Color color = img.GetPixel(x, y);</lang csharp>
Anonymous user