在以下代码中:
Bitmap bmp = new Bitmap((int)ArrayHeight, (int)ArrayWidth, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
Graphics gBmp = Graphics.FromImage(bmp);
gBmp.CompositingMode = CompositingMode.SourceCopy;
System.Drawing.Color green = System.Drawing.Color.FromArgb(0x40, 0, 0xff, 0);
System.Drawing.Brush greenBrush = new SolidBrush(green);
gBmp.FillPolygon(greenBrush, polygonPoints);
for (int i = 0; i < ArrayHeight; i++)
{
for (int j = 0; j < ArrayWidth; j++)
{
System.Drawing.Color pixel = bmp.GetPixel(i,j);
if (pixel.IsSystemColor.Equals("green"))
{
PolyArray[i, j] = (byte)TerrainValue;
}
}
}
我想检查位图中该位置的像素是否是系统绘图颜色“绿色”,但它永远不会返回 true。
我究竟做错了什么?