【发布时间】:2014-01-28 01:24:57
【问题描述】:
在我尝试编写一些代码时,我收到了这个错误:
错误 1 'System.Drawing.Image' 不包含 'GetPixel' 并且没有扩展方法 'GetPixel' 接受第一个 可以找到“System.Drawing.Image”类型的参数(你是 缺少 using 指令或程序集引用?)
有人知道我需要做什么吗?
//Create a Image-Object on which we can draw
Image bmp = new Bitmap(100, 100);
//Create the Graphics-Object to paint on the Bitmap
Graphics g = Graphics.FromImage(bmp);
g.Clear(Color.White);
g.DrawString(randomString, myFont, new SolidBrush(Color.Black), new PointF(0, 0));
pictureBox1.Image = bmp;
bmp.Save(@"CAPTCHA.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
var backgroundPixels = 0;
for (int x = 0; x < bmp.Width; x++)
for (int y = 0; y < bmp.Height; y++)
if (bmp.GetPixel(x, y) == Color.White)
backgroundPixels++;
【问题讨论】:
-
你应该分享你的代码。
-
你是怎么得到这个错误的?除非显示特定代码,否则它可能太宽泛了
标签: c#