????? ????? ??? ??????? ?? ???? ???? ????? ?????

?????? ????????? ?????? ?????????
???? ???????: 179909 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

???? ??? ??????? ????? ????? ??? ????? ?? ????? ????? ?? ???? ???? ????? ?????. ???? ????? ???? ???? ???? ? ???? ????? ?? ????? ??? ???? ???? ????? ????? ?? ???? ?????? ???????? ???? ???????.

??????? ????

?????? ??? ????? ?? ????? ????? ??? ????? ????? ??????? ???? ?????? ??? ??????? ????? FillRect() ?????? ????? ?????? ??????? ???? ?? ????? ?????? ?? ??????? ??????? SetBkColor() ??? ????? ??????? ??????? TextOut() ?? ???? ???? ????? ?? ???? ??? ????? ???????.

????? ????? ????? ???? ???? ????? ????? ?? ???? ?????? ?? ??? ???? ???????? ????? "?????? ??? ????" ????? ??????? ????? ????. ??? ??? ???? ???? ???? ?????? ???? ???? ????? ????? ????? ????? ???? ?????? ?? CreateWindow() ?? CreateWindowEx() ???? ?? ????? TCS_OWNERDRAWFIXED ?? ?? ??????? dwStyle.

????? # ??????? ????????? ?? ???????:
        #define RED     RGB(255,0,0)
        #define YELLOW  RGB(255,255,0)
        #define MAGENTA RGB(255,0,255)
        #define WHITE   RGB(255,255,255)
        #define BLUE    RGB(0,0,255)
				

??? ??? ??????? SDK

????????? ?? ??? ????? ????? ?? ??????? ?? WM_INITDIALOG ??? ????? ?????.

????? ????? WM_DRAWITEM ??? ??????? ???? ??????.

??? ?????

   case WM_DRAWITEM:
      lpdis = (LPDRAWITEMSTRUCT) lParam; // item drawing information
      hTabCtrl = GetDlgItem(hDlg, IDC_TAB1);

      if (hTabCtrl == lpdis->hwndItem)   // is this the tab control?
      {
         // which tab? first, second...fifth
         switch (lpdis->itemID)
         {
         case 0:
            hbr = hbrRed;
            bkColor = RED;
            break;
         case 1:
            hbr = hbrYellow;
            bkColor = YELLOW;
            break;
         case 2:
            hbr = hbrMagenta;
            bkColor = MAGENTA;
            break;
         case 3:
            hbr = hbrWhite;
            bkColor = WHITE;
            break;
         case 4:
            hbr = hbrBlue;
            bkColor = BLUE;
            break;
         }

         memset(szTabText, '\0', sizeof(szTabText));

         tci.mask = TCIF_TEXT;
         tci.pszText = szTabText;
         tci.cchTextMax = sizeof(szTabText)-1;

         TabCtrl_GetItem(hTabCtrl, lpdis->itemID, &tci);

         FillRect(lpdis->hDC, &lpdis->rcItem, hbr);
         SetBkColor(lpdis->hDC, bkColor);

         TextOut(lpdis->hDC,
               lpdis->rcItem.left,
               lpdis->rcItem.top,
               tci.pszText,
               lstrlen(tci.pszText));
      }
      break;
				

??? ??? ???? ??? ??????? MFC

????????? ??????? ??? ??? ?? ??? ?????? ??? ?? ??????? ????? ?? ??????? ????? ??????.

????? ????? OnDrawItem() ????? CDialog ?????? ???????? ????? ??? ?????? ???????? ???????? ???????? ????? ????? ????????? ?? ????????. ?? ????? ???? ?? ???? ??? ???? CDC ?? ????? DC ??????? ??? LPDRAWITEMSTRUCT ????? ???? ???? ????? ???? ??? ??? ????? ???????.

??? ?????

       void CMFCTabCtrlDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpdis)
       {
          CDialog::OnDrawItem(nIDCtl, lpdis);

          char        szTabText[100];
          RECT        rect;
          UINT        bkColor;
          CBrush      *cbr;
          TC_ITEM     tci;

          CTabCtrl    *pTabCtrl = (CTabCtrl *)GetDlgItem(IDC_TAB1);

          if (pTabCtrl->m_hWnd == lpdis->hwndItem)
          {
              // which tab?
              switch (lpdis->itemID)
              {
              case 0:
                  cbr = &m_brRed;
                  bkColor = RED;
                  break;

              case 1:
                  cbr = &m_brYellow;
                  bkColor = YELLOW;
                  break;

              case 2:
                  cbr = &m_brMagenta;
                  bkColor = MAGENTA;
                  break;

              case 3:
                  cbr = &m_brWhite;
                  bkColor = WHITE;
                  break;

              case 4:
                  cbr = &m_brBlue;
                  bkColor = BLUE;
                  break;
              }

              memset(szTabText, '\0', sizeof(szTabText));

              tci.mask        = TCIF_TEXT;
              tci.pszText     = szTabText;
              tci.cchTextMax  = sizeof(szTabText)-1;

              pTabCtrl->GetItem(lpdis->itemID, &tci);

              CDC *dc = CDC::FromHandle(lpdis->hDC);

              dc->FillRect(&lpdis->rcItem, cbr);
              dc->SetBkColor(bkColor);

              TextOut(lpdis->hDC,
                      lpdis->rcItem.left,
                      lpdis->rcItem.top,
                      tci.pszText,
                      lstrlen(tci.pszText));
          }
       }
				

???????

???? ???????: 179909 - ????? ??? ??????: 05/????? ???????/1426 - ??????: 1.3
????? ???
  • Microsoft Platform Software Development Kit-January 2000 Edition
  • Microsoft Visual Studio 97 Service Pack 3
  • Microsoft Visual C++ 5.0 Professional Edition
  • Microsoft Visual C++ 6.0 Professional Edition
  • Microsoft Visual Basic 5.0 Enterprise Edition
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0
????? ??????: 
kbmt kbctrl kbhowto kbtabctrl KB179909 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????179909

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com