Search code examples
c#system.drawingsystem.drawing.color

'System.Drawing.Color' does not contain a definition for 'FromARgb'


I have added System.Drawing as a reference, yet this code seems to fail on the line where I declare the new color

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.Windows.Forms;
using System.IO;


namespace BitmapParser
{
    class Program
    {
        static void Main(string[] args)
        {
            Color a = Color.FromARgb(0, 255, 0);
        }
    }
}

So what is going on here? I looked up System.Drawing.Color and it does have a 3-int constructor https://msdn.microsoft.com/en-us/library/system.drawing.color.aspx


Solution

  • Did you try spelling it correctly? This works fine for me:

    var clr = System.Drawing.Color.FromArgb(0, 128, 255);