If a pixel on a certain position of my screen is blue, press the down key.
How do I code this?
(How do I) If pixel on thispos is blue, press Down key?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Danatas GerviRank #4,152 · 361 reputationPosted Aug 2, 2009, 1:54 AM EDT
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (this.BackgroundImage != null)
{
Color underColor = ((Bitmap)this.BackgroundImage).GetPixel(e.X, e.Y);
if (underColor == Color.Blue)
{
OnKeyDown(new KeyEventArgs(Keys.Down));
}
}
}
If you want to get color from any place on screen - I think you should use Windows API....