using System;
using System.Drawing;
using System.Windows.Forms;
class Program
{
static void Main()
{
// Define the RGB color to check
Color colorToCheck = Color.FromArgb(255, 255, 100);
// Capture the screen
using (Bitmap screenBitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height))
{
using (Graphics g = Graphics.FromImage(screenBitmap))
{
g.CopyFromScreen(0, 0, 0, 0, screenBitmap.Size);
}
// Check if the color is present on the screen
bool colorFound = false;
for (int x = 0; x < screenBitmap.Width; x++)
{
for (int y = 0; y < screenBitmap.Height; y++)
{
if (screenBitmap.GetPixel(x, y) == colorToCheck)
{
colorFound = true;
break;
}
}
if (colorFound)
break;
}
// Print the result
if (colorFound)
{
Console.WriteLine("The RGB color (255, 255, 100) is displayed on the screen.");
}
else
{
Console.WriteLine("The RGB color (255, 255, 100) is not displayed on the screen.");
}
}
}
}
using System;
using System.Drawing;
using System.Windows.Forms;
class Program
{
static void Main()
{
// Define the RGB color to check
Color colorToCheck = Color.FromArgb(255, 255, 100);
// Capture the screen
using (Bitmap screenBitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height))
{
using (Graphics g = Graphics.FromImage(screenBitmap))
{
g.CopyFromScreen(0, 0, 0, 0, screenBitmap.Size);
}
// Check if the color is present on the screen
bool colorFound = false;
for (int x = 0; x < screenBitmap.Width; x++)
{
for (int y = 0; y < screenBitmap.Height; y++)
{
if (screenBitmap.GetPixel(x, y) == colorToCheck)
{
colorFound = true;
break;
}
}
if (colorFound)
break;
}
// Print the result
if (colorFound)
{
Console.WriteLine("The RGB color (255, 255, 100) is displayed on the screen.");
}
else
{
Console.WriteLine("The RGB color (255, 255, 100) is not displayed on the screen.");
}
}
}
}