pekabo
asked on
Trigger Pixel Change on Screen and do something
Hi @ all
GetColor allows me to retrieve the color of any pixel on the screen
Now i attempt to solve out how to trigger an action whenever the pixel color of X,Y-coordinates anywhere on screen changes. This should stop the methode RunApp() and start again.
Thanks in advance!
GetColor allows me to retrieve the color of any pixel on the screen
Now i attempt to solve out how to trigger an action whenever the pixel color of X,Y-coordinates anywhere on screen changes. This should stop the methode RunApp() and start again.
Thanks in advance!
public Color GetColor(int x, int y)
{
Bitmap b = new Bitmap(1, 1);
Graphics g = Graphics.FromImage(b);
g.CopyFromScreen(x, y, 0, 0, b.Size);
g.Dispose();
Color c = b.GetPixel(0, 0);
b.Dispose();
return c;
}
public void RunApp()
{
if (comboBoxPlatzAmTisch.Text == "")
{
MessageBox.Show("Geben Sie Ihren Platz am Tisch an!");
}
else
{
Color sResult = GetColor(iKartenPositionen[i, 0], iKartenPositionen[i, 1]);
sResult = KarteVorhanden();
if (sResult == true)
{
ScreenshotSpieler(iSpielerPlatz);
bool fAktiv = GetPixelColor();
if (fAktiv == true){
//here follows more nested if statements}
}
else
{
Pockal.Clear();
Tisch.Clear();
Gegner.SelectedIndex = 0;
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.