• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
              1 
              2 #ifdef    BTNST_USE_BCMENU
              3 LRESULT CButtonST::OnMenuChar(UINT nChar, UINT nFlags, CMenu* pMenu) 
              4 {
              5     LRESULT lResult;
              6     if (BCMenu::IsMenu(pMenu))
              7         lResult = BCMenu::FindKeyboardShortcut(nChar, nFlags, pMenu);
              8     else
              9         lResult = CButton::OnMenuChar(nChar, nFlags, pMenu);
             10     return lResult;
             11 // End of OnMenuChar
             12 #endif
             13 
             14 #ifdef    BTNST_USE_BCMENU
             15 void CButtonST::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) 
             16 {
             17     BOOL bSetFlag = FALSE;
             18     if (lpMeasureItemStruct->CtlType == ODT_MENU)
             19     {
             20         if (IsMenu((HMENU)lpMeasureItemStruct->itemID) && BCMenu::IsMenu((HMENU)lpMeasureItemStruct->itemID))
             21         {
             22             m_menuPopup.MeasureItem(lpMeasureItemStruct);
             23             bSetFlag = TRUE;
             24         } // if
             25     } // if
             26     if (!bSetFlag) CButton::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
             27 // End of OnMeasureItem
             28 #endif
             29 
             30 void CButtonST::OnEnable(BOOL bEnable) 
             31 {
             32     CButton::OnEnable(bEnable);
             33     
             34     if (bEnable == FALSE)    
             35     {
             36         CWnd*    pWnd = GetParent()->GetNextDlgTabItem(this);
             37         if (pWnd)
             38             pWnd->SetFocus();
             39         else
             40             GetParent()->SetFocus();
             41 
             42         CancelHover();
             43     } // if
             44 // End of OnEnable
             45 
             46 void CButtonST::OnKillFocus(CWnd * pNewWnd)
             47 {
             48     CButton::OnKillFocus(pNewWnd);
             49     CancelHover();
             50 // End of OnKillFocus
             51 
             52 void CButtonST::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) 
             53 {
             54     CButton::OnActivate(nState, pWndOther, bMinimized);
             55     if (nState == WA_INACTIVE)    CancelHover();
             56 // End of OnActivate
             57 
             58 void CButtonST::OnCancelMode() 
             59 {
             60     CButton::OnCancelMode();
             61     CancelHover();
             62 // End of OnCancelMode
             63 
             64 BOOL CButtonST::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
             65 {
             66     // If a cursor was specified then use it!
             67     if (m_hCursor != NULL)
             68     {
             69         ::SetCursor(m_hCursor);
             70         return TRUE;
             71     } // if
             72 
             73     return CButton::OnSetCursor(pWnd, nHitTest, message);
             74 // End of OnSetCursor
             75 
             76 void CButtonST::CancelHover()
             77 {
             78     // Only for flat buttons
             79     if (m_bIsFlat)
             80     {
             81         if (m_bMouseOnButton)
             82         {
             83             m_bMouseOnButton = FALSE;
             84             Invalidate();
             85         } // if
             86     } // if
             87 // End of CancelHover
             88 
             89 void CButtonST::OnMouseMove(UINT nFlags, CPoint point)
             90 {
             91     CWnd*                wndUnderMouse = NULL;
             92     CWnd*                wndActive = this;
             93     TRACKMOUSEEVENT        csTME;
             94 
             95     CButton::OnMouseMove(nFlags, point);
             96 
             97     ClientToScreen(&point);
             98     wndUnderMouse = WindowFromPoint(point);
             99 
            100     // If the mouse enter the button with the left button pressed then do nothing
            101     if (nFlags & MK_LBUTTON && m_bMouseOnButton == FALSE) return;
            102 
            103     // If our button is not flat then do nothing
            104     if (m_bIsFlat == FALSE) return;
            105 
            106     if (m_bAlwaysTrack == FALSE)    wndActive = GetActiveWindow();
            107 
            108     if (wndUnderMouse && wndUnderMouse->m_hWnd == m_hWnd && wndActive)
            109     {
            110         if (!m_bMouseOnButton)
            111         {
            112             m_bMouseOnButton = TRUE;
            113 
            114             Invalidate();
            115 
            116 #ifdef    BTNST_USE_SOUND
            117             // Play sound ?
            118             if (m_csSounds[0].lpszSound)
            119                 ::PlaySound(m_csSounds[0].lpszSound, m_csSounds[0].hMod, m_csSounds[0].dwFlags);
            120 #endif
            121 
            122             csTME.cbSize = sizeof(csTME);
            123             csTME.dwFlags = TME_LEAVE;
            124             csTME.hwndTrack = m_hWnd;
            125             ::_TrackMouseEvent(&csTME);
            126         } // if
            127     } else CancelHover();
            128 // End of OnMouseMove
            129 
            130 // Handler for WM_MOUSELEAVE
            131 LRESULT CButtonST::OnMouseLeave(WPARAM wParam, LPARAM lParam)
            132 {
            133     CancelHover();
            134     return 0;
            135 // End of OnMouseLeave
            136 
            137 BOOL CButtonST::OnClicked() 
            138 {    
            139     SetFocus();
            140 
            141 #ifdef    BTNST_USE_SOUND
            142     // Play sound ?
            143     if (m_csSounds[1].lpszSound)
            144         ::PlaySound(m_csSounds[1].lpszSound, m_csSounds[1].hMod, m_csSounds[1].dwFlags);
            145 #endif
            146 
            147     if (m_bIsCheckBox)
            148     {
            149         m_nCheck = !m_nCheck;
            150         Invalidate();
            151     } // if
            152     else
            153     {
            154         // Handle the menu (if any)
            155 #ifdef    BTNST_USE_BCMENU
            156         if (m_menuPopup.m_hMenu)
            157 #else
            158         if (m_hMenu)
            159 #endif
            160         {
            161             CRect    rWnd;
            162             GetWindowRect(rWnd);
            163 
            164             m_bMenuDisplayed = TRUE;
            165             Invalidate();
            166 
            167 #ifdef    BTNST_USE_BCMENU
            168             BCMenu* psub = (BCMenu*)m_menuPopup.GetSubMenu(0);
            169             if (m_csCallbacks.hWnd)    ::SendMessage(m_csCallbacks.hWnd, m_csCallbacks.nMessage, (WPARAM)psub, m_csCallbacks.lParam);
            170             DWORD dwRetValue = psub->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD, rWnd.left, rWnd.bottom, this, NULL);
            171 #else
            172             HMENU hSubMenu = ::GetSubMenu(m_hMenu, 0);
            173             if (m_csCallbacks.hWnd)    ::SendMessage(m_csCallbacks.hWnd, m_csCallbacks.nMessage, (WPARAM)hSubMenu, m_csCallbacks.lParam);
            174             DWORD dwRetValue = ::TrackPopupMenuEx(hSubMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD, rWnd.left, rWnd.bottom, m_hParentWndMenu, NULL);
            175 #endif
            176 
            177             m_bMenuDisplayed = FALSE;
            178             Invalidate();
            179 
            180             if (dwRetValue)
            181                 ::PostMessage(m_hParentWndMenu, WM_COMMAND, MAKEWPARAM(dwRetValue, 0), (LPARAM)NULL);
            182         } // if
            183         else
            184         {
            185             // Handle the URL (if any)
            186             if (_tcslen(m_szURL) > 0)
            187             {
            188                 SHELLEXECUTEINFO    csSEI;
            189 
            190                 memset(&csSEI, 0sizeof(csSEI));
            191                 csSEI.cbSize = sizeof(SHELLEXECUTEINFO);
            192                 csSEI.fMask = SEE_MASK_FLAG_NO_UI;
            193                 csSEI.lpVerb = _T("open");
            194                 csSEI.lpFile = m_szURL;
            195                 csSEI.nShow = SW_SHOWMAXIMIZED;
            196                 ::ShellExecuteEx(&csSEI);
            197             } // if
            198         } // else
            199     } // else
            200 
            201     return FALSE;
            202 // End of OnClicked
            203 
            204 void CButtonST::DrawItem(LPDRAWITEMSTRUCT lpDIS)
            205 {
            206     CDC*    pDC = CDC::FromHandle(lpDIS->hDC);
            207 
            208     // Checkbox?
            209     if (m_bIsCheckBox)
            210     {
            211         m_bIsPressed  =  (lpDIS->itemState & ODS_SELECTED) || (m_nCheck != 0);
            212     } // if
            213     else    // Normal button OR other button style 
            214     {
            215         m_bIsPressed = (lpDIS->itemState & ODS_SELECTED);
            216 
            217         // If there is a menu and it's displayed, draw the button as pressed
            218         if (
            219 #ifdef    BTNST_USE_BCMENU
            220             m_menuPopup.m_hMenu 
            221 #else
            222             m_hMenu 
            223 #endif
            224             && m_bMenuDisplayed)    m_bIsPressed = TRUE;
            225     } // else
            226 
            227     m_bIsFocused  = (lpDIS->itemState & ODS_FOCUS);
            228     m_bIsDisabled = (lpDIS->itemState & ODS_DISABLED);
            229 
            230     CRect itemRect = lpDIS->rcItem;
            231 
            232     pDC->SetBkMode(TRANSPARENT);
            233 
            234     // Prepare draw paint button background
            235 
            236     // Draw transparent?
            237     if (m_bDrawTransparent)
            238         PaintBk(pDC);
            239     else
            240         OnDrawBackground(pDC, &itemRect);
            241 
            242     // Draw button border
            243     OnDrawBorder(pDC, &itemRect);
            244 
            245     // Read the button's title
            246     CString sTitle;
            247     GetWindowText(sTitle);
            248 
            249     CRect captionRect = lpDIS->rcItem;
            250 
            251     // Draw the icon
            252     if (m_csIcons[0].hIcon)
            253     {
            254         DrawTheIcon(pDC, !sTitle.IsEmpty(), &lpDIS->rcItem, &captionRect, m_bIsPressed, m_bIsDisabled);
            255     } // if
            256 
            257     if (m_csBitmaps[0].hBitmap)
            258     {
            259         pDC->SetBkColor(RGB(255,255,255));
            260         DrawTheBitmap(pDC, !sTitle.IsEmpty(), &lpDIS->rcItem, &captionRect, m_bIsPressed, m_bIsDisabled);
            261     } // if
            262 
            263     // Write the button title (if any)
            264     if (sTitle.IsEmpty() == FALSE)
            265     {
            266         DrawTheText(pDC, (LPCTSTR)sTitle, &lpDIS->rcItem, &captionRect, m_bIsPressed, m_bIsDisabled);
            267     } // if
            268 
            269     if (m_bIsFlat == FALSE || (m_bIsFlat && m_bDrawFlatFocus))
            270     {
            271         // Draw the focus rect
            272         if (m_bIsFocused)
            273         {
            274             CRect focusRect = itemRect;
            275             focusRect.DeflateRect(33);
            276             pDC->DrawFocusRect(&focusRect);
            277         } // if
            278     } // if
            279 // End of DrawItem
            280 
            281 void CButtonST::PaintBk(CDC* pDC)
            282 {
            283     CClientDC clDC(GetParent());
            284     CRect rect;
            285     CRect rect1;
            286 
            287     GetClientRect(rect);
            288 
            289     GetWindowRect(rect1);
            290     GetParent()->ScreenToClient(rect1);
            291 
            292     if (m_dcBk.m_hDC == NULL)
            293     {
            294         m_dcBk.CreateCompatibleDC(&clDC);
            295         m_bmpBk.CreateCompatibleBitmap(&clDC, rect.Width(), rect.Height());
            296         m_pbmpOldBk = m_dcBk.SelectObject(&m_bmpBk);
            297         m_dcBk.BitBlt(00, rect.Width(), rect.Height(), &clDC, rect1.left, rect1.top, SRCCOPY);
            298     } // if
            299 
            300     pDC->BitBlt(00, rect.Width(), rect.Height(), &m_dcBk, 00, SRCCOPY);
            301 // End of PaintBk
            Posted on 2007-04-12 11:46 艾凡赫 閱讀(1007) 評論(0)  編輯 收藏 引用 所屬分類: MFC技術
            成人妇女免费播放久久久| 国产精品九九久久免费视频| 一本色综合久久| 99久久免费国产精品特黄| 国产亚洲精品久久久久秋霞 | 久久人人爽人人爽人人片AV麻烦| 久久久这里有精品中文字幕| 久久人妻无码中文字幕| 久久精品国产亚洲一区二区| 久久综合九色综合久99| 97r久久精品国产99国产精| 久久噜噜久久久精品66| 99久久人妻无码精品系列| 亚洲午夜久久久| 国产精品无码久久久久久| 欧美亚洲另类久久综合婷婷| 国产精品久久久久9999| 久久亚洲国产最新网站| 天天综合久久久网| 一本色道久久88精品综合| 欧美久久一级内射wwwwww.| 久久综合狠狠综合久久激情 | 欧美亚洲国产精品久久| 99国内精品久久久久久久| 国产美女久久精品香蕉69| 亚洲精品无码久久久| 久久国产免费| 亚洲精品高清国产一久久| 久久久久亚洲av无码专区导航| 久久有码中文字幕| 久久久久亚洲AV无码专区网站| 一级做a爱片久久毛片| 久久人人爽人人爽人人片av高请| 久久久亚洲裙底偷窥综合| 一级女性全黄久久生活片免费| 久久久精品日本一区二区三区 | 韩国三级中文字幕hd久久精品 | 欧美一区二区久久精品| 久久人妻少妇嫩草AV蜜桃| 国产精品无码久久综合网| 久久国产精品久久久|