画笔:
SolidBrush semiTransBrush2 = new SolidBrush(Color.FromArgb(0,HexToInt(strColor,"red"), HexToInt(strColor,"green"), HexToInt(strColor,"blue")));

解决方案 »

  1.   

    System.Drawing.Image imgPhoto = System.Drawing.Image.FromFile(@"E:\quick_template\DefaultPageTemplate\11\DefaultPageBanner.gif");
     Bitmap bmPhoto = new Bitmap(600, 200, PixelFormat.Format32bppRgb);
     
     Graphics grPhoto = Graphics.FromImage(bmPhoto); 
      

    // Create string to draw.
    String drawString = "文字叠加到图片上";

    // Create font and brush.
    Font drawFont = new Font("方正舒体", 36);
    SolidBrush drawBrush = new SolidBrush(Color.Black);

    // Create point for upper-left corner of drawing.
    float x = 150.0F;
    float y =  50.0F;

    // Set format of string.
    StringFormat drawFormat = new StringFormat();
    //drawFormat.FormatFlags = StringFormatFlags.DirectionVertical;

    // Draw string to screen.

     
    grPhoto.DrawImage(
    imgPhoto,                               // Photo Image object
    new Rectangle(0, 0, 600, 200), // Rectangle structure
    0,                                      // x-coordinate of the portion of the source image to draw. 
    0,                                      // y-coordinate of the portion of the source image to draw. 
    600,                                // Width of the portion of the source image to draw. 
    200,                               // Height of the portion of the source image to draw. 
    GraphicsUnit.Pixel);  

    grPhoto.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);
    imgPhoto=bmPhoto;
    imgPhoto.Save("c:\\test.gif", ImageFormat.Gif);