Click here to Skip to main content
16,004,969 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Icons not loading in Ribbon UI - 32 bit bitmaps Pin
VC++Maniac5-Dec-08 2:30
VC++Maniac5-Dec-08 2:30 
GeneralRe: Icons not loading in Ribbon UI - 32 bit bitmaps Pin
Code-o-mat5-Dec-08 2:32
Code-o-mat5-Dec-08 2:32 
GeneralRe: Icons not loading in Ribbon UI - 32 bit bitmaps Pin
VC++Maniac5-Dec-08 2:42
VC++Maniac5-Dec-08 2:42 
GeneralRe: Icons not loading in Ribbon UI - 32 bit bitmaps Pin
Code-o-mat5-Dec-08 2:44
Code-o-mat5-Dec-08 2:44 
QuestionTab Control Color Pin
Davitor4-Dec-08 19:16
Davitor4-Dec-08 19:16 
AnswerRe: Tab Control Color Pin
YoungJin Shin4-Dec-08 20:16
YoungJin Shin4-Dec-08 20:16 
GeneralRe: Tab Control Color Pin
Davitor4-Dec-08 20:34
Davitor4-Dec-08 20:34 
GeneralRe: Tab Control Color Pin
Iain Clarke, Warrior Programmer4-Dec-08 22:32
Iain Clarke, Warrior Programmer4-Dec-08 22:32 
Here is the sample code from that page.
It gave a pure Win32 example, and the below MFC example.

Iain.

The brushes referred to are part of the dialog class and were created when the dialog constructor was called.

Override the OnDrawItem() method for your CDialog derived class using Class Wizard and add the following code, changing variable names as neccessary. It is important to note that a pointer to a CDC object from the handle of the DC passed in via the LPDRAWITEMSTRUCT is required, otherwise only the background of the text will be the desired color. 

        #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)
				
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));
          }
       }

Questionattach an icon to mouse cursor [modified] Pin
vikas choudhry4-Dec-08 17:45
vikas choudhry4-Dec-08 17:45 
AnswerRe: attach an icon to mouse cursor Pin
ThatsAlok4-Dec-08 18:37
ThatsAlok4-Dec-08 18:37 
GeneralRe: attach an icon to mouse cursor Pin
vikas choudhry4-Dec-08 19:01
vikas choudhry4-Dec-08 19:01 
GeneralRe: attach an icon to mouse cursor Pin
vikas choudhry4-Dec-08 20:24
vikas choudhry4-Dec-08 20:24 
GeneralRe: attach an icon to mouse cursor Pin
Hamid_RT4-Dec-08 21:21
Hamid_RT4-Dec-08 21:21 
GeneralRe: attach an icon to mouse cursor Pin
vikas choudhry4-Dec-08 21:59
vikas choudhry4-Dec-08 21:59 
GeneralRe: attach an icon to mouse cursor Pin
Hamid_RT4-Dec-08 22:19
Hamid_RT4-Dec-08 22:19 
GeneralRe: attach an icon to mouse cursor Pin
vikas choudhry7-Dec-08 17:31
vikas choudhry7-Dec-08 17:31 
GeneralRe: attach an icon to mouse cursor Pin
Hamid_RT7-Dec-08 18:18
Hamid_RT7-Dec-08 18:18 
GeneralRe: attach an icon to mouse cursor Pin
vikas choudhry7-Dec-08 18:25
vikas choudhry7-Dec-08 18:25 
GeneralRe: attach an icon to mouse cursor Pin
Hamid_RT7-Dec-08 18:39
Hamid_RT7-Dec-08 18:39 
GeneralRe: attach an icon to mouse cursor Pin
vikas choudhry7-Dec-08 18:43
vikas choudhry7-Dec-08 18:43 
GeneralRe: attach an icon to mouse cursor Pin
Hamid_RT7-Dec-08 18:51
Hamid_RT7-Dec-08 18:51 
GeneralRe: attach an icon to mouse cursor Pin
vikas choudhry7-Dec-08 23:59
vikas choudhry7-Dec-08 23:59 
GeneralRe: attach an icon to mouse cursor Pin
Hamid_RT8-Dec-08 2:25
Hamid_RT8-Dec-08 2:25 
GeneralRe: attach an icon to mouse cursor Pin
vikas choudhry8-Dec-08 17:18
vikas choudhry8-Dec-08 17:18 
GeneralRe: attach an icon to mouse cursor Pin
vikas choudhry9-Dec-08 1:32
vikas choudhry9-Dec-08 1:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.