© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
17 replies
Evade

The type or namespace name 'Screen' does not exist in the namespace 'System.Windows.Forms'

no clue why
code:

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.");
            }
        }
    }
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ the type or namespace name 'ListingProjects' does not exist in the namespace models
C#CC# / help
11mo ago
❔ The type or namespace name 'MAUI' does not exist in the namespace 'Microsoft'
C#CC# / help
4y ago
The name "___" does not exist in the namespace "clr-namespace:redfish.Controls"
C#CC# / help
5mo ago
✅ The name does not exist in current context. (forms)
C#CC# / help
4y ago