Anonymous user
Color of a screen pixel: Difference between revisions
no edit summary
({{omit from|AWK|Does not have this functionality in the language}}) |
No edit summary |
||
Line 216:
=={{header|C++/CLI}}==
<lang cpp>
using namespace System;
using namespace System::Drawing;
using namespace System::Windows::Forms;
Bitmap ^ myBitmap = gcnew Bitmap(1,1);▼
[STAThreadAttribute]
Graphics ^ g = Graphics::FromImage(myBitmap); ▼
int main()
g->CopyFromScreen(pt, Drawing::Point(0, 0), Drawing::Size(1, 1));▼
{
Color color = myBitmap->GetPixel(0,0);▼
Point^ MousePoint = gcnew Point();
this->Red->Text=color.R.ToString();▼
Control^ TempControl = gcnew Control();
this->Blue->Text=color.B.ToString();▼
MousePoint = TempControl->MousePosition;
this->Green->Text=color.G.ToString();▼
}
</lang>
|