LRESULT CWin::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { LRESULT lRes = 0; BOOL bHandled = TRUE; switch (uMsg) { case WM_CREATE: lRes = OnCreate(uMsg, wParam, lParam, bHandled); break; case WM_CLOSE: lRes = OnClose(uMsg, wParam, lParam, bHandled); break; case WM_DESTROY: lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break; #if defined(WIN32) && !defined(UNDER_CE) //case WM_NCCREATE: lRes = OnNcCreate(uMsg, wParam, lParam, bHandled); break; case WM_NCMOUSEMOVE: lRes = OnNCMouseMove(uMsg, wParam, lParam, bHandled); break; case WM_NCMOUSELEAVE: lRes = OnNCMouseLeave(uMsg, wParam, lParam, bHandled); break; case WM_NCACTIVATE: lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break; case WM_NCCALCSIZE: lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled); break; case WM_NCPAINT: lRes = OnNcPaint(uMsg, wParam, lParam, bHandled); break; case WM_NCHITTEST: lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled); break; case WM_GETMINMAXINFO: lRes = OnGetMinMaxInfo(uMsg, wParam, lParam, bHandled); break; case WM_MOUSEWHEEL: lRes = OnMouseWheel(uMsg, wParam, lParam, bHandled); break; #endif case WM_ERASEBKGND: lRes = OnEraseBkGnd(uMsg, wParam, lParam, bHandled); break; case WM_SIZE: lRes = OnSize(uMsg, wParam, lParam, bHandled); break; case WM_CHAR: lRes = OnChar(uMsg, wParam, lParam, bHandled); break; case WM_SYSCOMMAND: lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); break; case WM_KEYDOWN: lRes = OnKeyDown(uMsg, wParam, lParam, bHandled); break; case WM_KILLFOCUS: lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); break; case WM_SETFOCUS: lRes = OnSetFocus(uMsg, wParam, lParam, bHandled); break; case WM_LBUTTONUP: lRes = OnLButtonUp(uMsg, wParam, lParam, bHandled); break; case WM_LBUTTONDOWN: lRes = OnLButtonDown(uMsg, wParam, lParam, bHandled); break; case WM_MOUSEMOVE: lRes = OnMouseMove(uMsg, wParam, lParam, bHandled); break; case WM_MOUSELEAVE: lRes = OnMouseLeave(uMsg, wParam, lParam, bHandled); break; case WM_MOUSEHOVER: lRes = OnMouseHover(uMsg, wParam, lParam, bHandled); break; case WM_HOTKEY: lRes = OnHotKey(uMsg, wParam, lParam, bHandled); break; // case WM_TIMER: lRes = OnTimer(uMsg, wParam, lParam, bHandled); break;//OnTimer响应有小问题 case WM_MOVING: lRes = OnMoving(uMsg, wParam, lParam, bHandled); break; case WM_SIZING: lRes = OnSizing(uMsg, wParam, lParam, bHandled); break; case WM_SHOWWINDOW: lRes = OnShowWindow(uMsg, wParam, lParam, bHandled); break; case WM_COMMAND: lRes = OnCommand(uMsg, wParam, lParam, bHandled); break; // case WM_PAINT: lRes = OnPaint(uMsg, wParam, lParam, bHandled); break;//OnPaint响应有问题 case WM_MENUCOMMAND: lRes = OnMenuCommand(uMsg, wParam, lParam, bHandled); break; default: bHandled = FALSE; break; } if (bHandled) return lRes; lRes = ProcessWindowMessage(uMsg, wParam, lParam, bHandled); if (bHandled) return lRes; if(_paintManager && _paintManager->MessageHandler(uMsg,wParam,lParam,lRes)) return lRes; return __super::HandleMessage(uMsg,wParam,lParam); }
void toolBarSwitch(WPARAM wParam, HWND hwnd){ switch(wParam){ case IDM_CURSOR: unselectAllTools(); break; case IDM_PEN: unselectAllTools(); freeformLine->setStatus(true); break; case IDM_BRUSH: feelColor = !feelColor; if(!feelColor) resetBrush(); else setBrush(); break; case IDM_LINE: unselectAllTools(); straightLine->setStatus(true); break; case IDM_VERT_LINE: unselectAllTools(); straightLine->setStatus(true); straightLine->setVertical(true); break; case IDM_HORIZ_LINE: unselectAllTools(); straightLine->setStatus(true); straightLine->setHorizontal(true); break; case IDM_ELLIPSE: unselectAllTools(); elipse->setStatus(true); break; case IDM_TETTRA: unselectAllTools(); tetragon->setStatus(true); break; case IDM_CONECTED_LINE: unselectAllTools(); straightLine->setStatus(true); straightLine->setConected(true); break; case IDM_BEZIER: unselectAllTools(); bezier->setStatus(true); break; case IDM_GRADIENT: OnEraseBkGnd(hwnd); break; case IDM_ERASER_1: unselectAllTools(); eraser->setThickenss(8); eraser->setStatus(true); break; case IDM_ERASER_2: unselectAllTools(); eraser->setThickenss(16); eraser->setStatus(true); break; case IDM_ERASER_3: unselectAllTools(); eraser->setThickenss(32); eraser->setStatus(true); break; case IDM_ERASER_4: unselectAllTools(); eraser2->setStatus(true); break; } }