Color of a screen pixel: Difference between revisions

add c++
(add c++)
Line 71:
let pt = Cursor.Position
GetPixel pt.X pt.Y
</lang>
 
=={{header|C++}}==
<lang fsharp>
Bitmap ^ myBitmap = gcnew Bitmap(1,1);
Graphics ^ g = Graphics::FromImage(myBitmap);
g->CopyFromScreen(pt, Drawing::Point(0, 0), Drawing::Size(1, 1));
Color color = myBitmap->GetPixel(0,0);
this->Red->Text=color.R.ToString();
this->Blue->Text=color.B.ToString();
this->Green->Text=color.G.ToString();
</lang>
 
Anonymous user