编译平台vc6
效果说明:
//透明窗口/贴图窗口
/* 单纯的窗口全局透明可使用SetLayeredWindowAttributes(子窗口也必定会跟着透明)
使用UpdateLayerWindow后 OnPaint不可用,但其他消息还是会响应,子控件将不会被显示需要自绘
//窗体样式为0x80000为层级窗体
DWORD dwExStyle=GetWindowLong(hWnd,GWL_EXSTYLE);
SetWindowLong(hWnd,GWL_EXSTYLE,dwExStyle^0x80000);
*/
GDI+的使用:
分别解压GDIPlus.zip下Lib和Include到vc6目录下D:\vc6.0\Microsoft Visual Studio\VC98\Lib和Include下
在Stdafx.h中加入一下代码
#include <comdef.h>//初始化一下com口
#ifndef ULONG_PTR
#define ULONG_PTR unsigned long*
#include "GdiPlus.h"
using namespace Gdiplus;
#endif
#pragma comment(lib, "gdiplus.lib")
//定义gdi+需要的两个参数
GdiplusStartupInput m_gdiplusStartupInput;
ULONG_PTR m_pGdiToken;
//启动
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
Gdiplus::GdiplusStartup(&m_pGdiToken, &m_gdiplusStartupInput, NULL);
//使用
void OnPaint(HWND hWnd)
{
HDC hdc=GetDC(hWnd);
Graphics imgraphics(hdc);
Image image(L"6.jpg");
imgraphics.DrawImage(&image,0,0);
}
//退出
GdiplusShutdown(m_pGdiToken);
- 1
- 2
前往页