请问怎么动态新建一个bmp然后在上面画中文字

解决方案 »

  1.   

    System.Drawing.Bitmap bmp = new Bitmap(WIDTH,HEIGHT);
    System.Drawing.Graphics g = Graphics.FromImage( bmp );
    g.FillRectangle( System.Drawing.Brushes.White , new Rectangle( 0 , 0 , 80,21) ); 
    Font f = new Font("Times New Roman",9);
    Brush b = Brushes.Red ;
    g.DrawString( STRING1 , f , b , 4.0f , 4.0f , System.Drawing.StringFormat.GenericTypographic);
      

  2.   

    还有忘记说了就是我要的图片格式是jpg的,有没有办法?
      

  3.   

    bmp.Save(destFilePath, ImageFormat.Jpeg);//需要using System.Drawing.Imaging;
      

  4.   

    bmp.Save( outstream , System.Drawing.Imaging.ImageFormat.Jpeg)
      

  5.   

    找到了,用Save方法!!谢谢了啊。
    to zhoufoxcn(执子之手):玩什么啊,我新手就不会麻,就要请教啊。