WEB开发网
开发学院软件开发VC SDK 程序使用SkinMagic工具包换皮肤 阅读

SDK 程序使用SkinMagic工具包换皮肤

 2010-06-15 20:40:08 来源:WEB开发网   
核心提示:还有在WndProc中,使定义的菜单资源和皮肤资源对应起来:LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){ int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; TCHAR

还有在WndProc中,使定义的菜单资源和皮肤资源对应起来:

LRESULT CALLBACK WndProc(HWND hWnd,
             UINT message,
             WPARAM wParam,
             LPARAM lParam)
{
   int wmId, wmEvent;
   PAINTSTRUCT ps;
   HDC hdc;
   TCHAR szHello[MAX_LOADSTRING];
   LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);

     //使用菜单变换皮肤,
     //通过数组的持续把菜单和皮肤资源对应,
   static char* idColor [7] = { "XPBLUE", "CORONA", "KROMO",
                 "XPGREAN", "XPLUS","XPSTEEL","DEVIOR" } ;
   ......

   switch (wmId)
   {
   case IDM_XP: // Note: Logic below
       case IDM_CORONA: //  assumes that IDM_WHITE
       case IDM_KROMO: //  through IDM_BLACK are
       case IDM_XPGREAN: //  consecutive numbers in
       case IDM_XPLUS : //  the order shown here.
   case IDM_XPSTEEL:
   case IDM_DEVIOR:

       //菜单选择
     CheckMenuItem (hMenu, iSelection, MF_UNCHECKED) ;
     iSelection = wmId ;
     CheckMenuItem (hMenu, iSelection, MF_CHECKED) ;
     LoadSkinFromResource( GetModuleHandle(NULL),
        idColor[LOWORD (wParam) - IDM_XP] ,
        "SKINMAGIC" );
     InvalidateRect (hWnd, NULL, TRUE) ;
     return 0 ;
   case IDM_ABOUT:
    DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
    break;
   case IDM_EXIT:
    DestroyWindow(hWnd);
    break;
   default:
    return DefWindowProc(hWnd, message, wParam, lParam);
   }
}

Tags:SDK 程序 使用

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接