I'm using windows Forms app in visual studio 2019. Never really used c# besides this but i'm trying to display the color of the pixel in the mouse coordinates. However the rgb always equals 0 for all.
public static Point GetMousePositionWindowsForms()
{
System.Drawing.Point point = Control.MousePosition;
return new Point(point.X, point.Y);
}
public static string Getcolor()
{
Bitmap screen = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Color getcolor = screen.GetPixel(GetMousePositionWindowsForms().X-1, GetMousePositionWindowsForms().Y-1);
return Convert.ToString(getcolor);
}