怎样生成这样的图象?就是在一个位图中有一些文字。当打开这个图象时,只有文字能看到?其余的背景都看不到??
怎样生成这样的图象?就是在一个位图中有一些文字。当打开这个图象时,只有文字能看到?其余的背景都看不到??
谢谢

解决方案 »

  1.   

    最简单的办法就是做成ICO文件,ICO文件支持透明背景
      

  2.   

    在VC中画BITMAP的时候可以指定背景色,如果是XP,直接用TransparentBlt(),最后一个参数指定背景颜色,如果不是XP,则可以用多次Blt,用and和xor操作来实现过滤背景色的方法。下面是摘出来的一段代码,这个代码不能直接用,具体请参考:http://www.codeproject.com/bitmap/membm.asp// create AND mask 
    Draw( bmAnd, 0, 0 ); 
    // create XOR mask
    bmAnd.Draw( bmXor, 0, 0, 0x220326 ); 
    bmTemp.Create( hDC, NULL, iLeft, iTop, iWidth, iHeight ); //copy hDC contents to temporary
    // blend the AND and XOR masks into the temporary bitmap
    bmAnd.Draw(bmTemp, 0, 0, iWidth, iHeight, iSrcLeft, iSrcTop, iSrcWidth, iSrcHeight, SRCAND); 
    bmXor.Draw(bmTemp, 0, 0, iWidth, iHeight, iSrcLeft, iSrcTop, iSrcWidth, iSrcHeight, SRCINVERT); 
    // draw the resulting image to the hDC
    bmTemp.Draw( hDC, iLeft, iTop, iWidth, iHeight );