各位高手谁有这方面的函数代码?如果有封装好的类就更好了!半透明就是两副图叠加时,可以透过上面的位图看到底下位图的!
解决方案 »
- 请问把其他的外部对象比如txt文件拖进vc的窗口中触发什么事件
- 关于函数返回作为左值的问题??
- 用SDK来写程序时,如何修改一个菜单项的标题文字?对你们来说很简单的问题,我搞不定.
- 初学vc++,应该学习.net还是vc++6?
- 类的一个成员函数如何调用另一个成员函数???
- 服务端向客户端发送一个结构体数组,用socket api,应该怎么组织数据,怎么发送最好?
- 如果得到从任何一个应用程序中弹出的各种窗口的位置和大小呢?请进来.分不够可以在加
- 请教如何把一个文件从一个位置移到另一个位置!
- 自制浏览器设置成默认浏览器后,无法响应系统链接。
- 用vc写简单的网页,最后总出现?,不知是什么原因?
- 估计这个问题只能找VC高手解结了
- 问一个简单的按钮刷新的问题
透明位图的显示
给你一个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);