在我尝试编写一些代码时,我收到了这个错误:
错误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++;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1012 次 |
| 最近记录: |