不好意思,写错了.上面的Color c=bmp.GetPixel(m,k);改为Color c=bmp.GetPixel(i,j);

解决方案 »

  1.   

    are you sure??System.Drawing.Bitmap bmp=new Bitmap(14,14);
    System.Drawing.Graphics g=Graphics.FromImage(bmp);
    g.Clear(Color.White);
    g.DrawString("hello",new Font("Arial",15,FontStyle.Regular,GraphicsUnit.Pixel),new SolidBrush(Color.Black),0,0);
    for(int i=0;i<14;i++)
    for(int j=0;j<14;j++)
    {
    Color c=bmp.GetPixel(i,j);
    if (c.B != 0xff)
    {
    MessageBox.Show("!");
    }
    }Graphics gh = this.CreateGraphics();
    gh.DrawImage(bmp,new Point(10,10));
      

  2.   

    根本运行以后就看不到hello!
    奇怪!
      

  3.   

    Constants in structure
    Color (all are
    public static) RGB value
    Constants in structure
    Color (all are
    public static) RGB value
    Orange 255, 200, 0 White 255, 255, 255
    Pink 255, 175, 175 Gray 128, 128, 128
    Cyan 0, 255, 255 DarkGray 64, 64, 64
    Magenta 255, 0, 255 Red 255, 0, 0
    Yellow 255, 255, 0 Green 0, 255, 0
    Black 0, 0, 0 Blue 0, 0, 255
      

  4.   

    To搂主:
    第二行,g使用Graphics的FromImage()建立,再建立一个新的对象后,g(Graphics)就与原来的位图脱离了关系,改变g的内容(譬如调用DrawString()方法)后,为图的内容不会相应变化,此时调用bmp(Bitmap)的GetPixel函数,当然得到的只是原来的bmp图片的内容,里面什么都没有,当然只是0xffff...~~~