各位高手谁有这方面的函数代码?如果有封装好的类就更好了!半透明就是两副图叠加时,可以透过上面的位图看到底下位图的!

解决方案 »

  1.   

    http://www.vckbase.com/code/listcode.asp?mclsid=7&sclsid=701
     透明位图的显示
      

  2.   

    使用GDI+
    给你一个MSDN上的例子
    Using a Color Matrix to Set Alpha Values in Images // Create a Bitmap object and load it with the texture image.
    Bitmap bitmap(L"Texture1.jpg");
    Pen pen(Color(255, 0, 0, 0), 25);
    // Initialize the color matrix.
    // Notice the value 0.8 in row 4, column 4.
    ColorMatrix colorMatrix = {1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
                               0.0f, 1.0f, 0.0f, 0.0f, 0.0f,
                               0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
                               0.0f, 0.0f, 0.0f, 0.8f, 0.0f,
                               0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
    // Create an ImageAttributes object and set its color matrix.
    ImageAttributes imageAtt;
    imageAtt.SetColorMatrix(&colorMatrix, ColorMatrixFlagsDefault,
       ColorAdjustTypeBitmap);
    // First draw a wide black line.
    graphics.DrawLine(&pen, Point(10, 35), Point(200, 35));
    // Now draw the semitransparent bitmap image.
    INT iWidth = bitmap.GetWidth();
    INT iHeight = bitmap.GetHeight();
    graphics.DrawImage(
       &bitmap, 
       Rect(30, 0, iWidth, iHeight),  // Destination rectangle
       0,                             // Source rectangle X 
       0,                             // Source rectangle Y
       iWidth,                        // Source rectangle width
       iHeight,                       // Source rectangle height
       UnitPixel, 
       &imageAtt);