睿豐德科技 專注RFID識別技術和條碼識別技術與管理軟件的集成項目。質量追溯系統、MES系統、金蝶與條碼系統對接、用友與條碼系統對接
源代碼:http://download.csdn.net/detail/nuptboyzhb/4219669
源代碼:
1. 插入一個對話框的資源,刪除默認控件,并為對話框創建一個類,命名為ClyricDlg;
2. 在對話框的頭文件中添加GDI+相關的頭文件和動態庫
#define UNICODE
#ifndef ULONG_PTR
#define ULONG_PTR unsigned long*
#endif
#include "GDIPlus\\Includes\\GdiPlus.h" ////Modify your path
using namespace Gdiplus;
#pragma comment(lib, "GDIPlus\\Lib\\gdiplus.lib") //Modify your lib path
3. 新增公有成員變量:
int m_kind;
int cx;
BOOL UpdateDisplay(int Transparent=255);
HINSTANCE hFuncInst ;
typedef BOOL (WINAPI *MYFUNC)(HWND,HDC,
POINT*,SIZE*,HDC,POINT*,COLORREF,BLENDFUNCTION*,DWORD);
MYFUNC UpdateLayeredWindow;
BLENDFUNCTION m_Blend;
HDC m_hdcMemory;
4. 新增私有成員變量:
BOOL m_bBack;
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
5. 在構造函數中初始化如下成員變量:
m_bBack=false;
m_kind=cx=0;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
6. 為對話框添加OnCreate函數,并編輯代碼如下:
hFuncInst = LoadLibrary("User32.DLL");
BOOL bRet=FALSE;
if(hFuncInst)
UpdateLayeredWindow=(MYFUNC)GetProcAddress(hFuncInst, "UpdateLayeredWindow");
else
{
AfxMessageBox("User32.dll ERROR!");
exit(0);
}
// Initialize GDI+.
m_Blend.BlendOp=0; //theonlyBlendOpdefinedinWindows2000
m_Blend.BlendFlags=0; //nothingelseisspecial...
m_Blend.AlphaFormat=1; //...
m_Blend.SourceConstantAlpha=255;//AC_SRC_ALPHA
7. 實現其成員函數UpdataDisplay
[cpp] view plaincopy