Home > Software engineering >  With what method to obtain the status CTabCtrl label
With what method to obtain the status CTabCtrl label

Time:09-22

Everybody is good, I want to custom painting CTabCtrl controls, in the label when encounter problems, I use the following two kinds of methods, the result is 0, regardless of the selected,
1. The DWORD state=GetItemState (nTab, TCIF_STATE)
2. Set the TCITEM
TCHAR label [64]={0};
TC_ITEM item;
Memset (& amp; Item, 0, sizeof (item));
Item. CchTextMax=64;
Item. The pszText=label;
Item. The mask=TCIF_TEXT | TCIF_STATE | TCIF_IMAGE;
The GetItem (independence idx, & amp; Item);

The above two methods are unable to get the desired results,
If I use in DrawItem LPDRAWITEMSTRUCT structure, of which the itemState is right,



CodePudding user response:

Very strange, why have you not CTabCtrl: : GetItemState?

CodePudding user response:

Written in my post, the first way is GetItemState ah, but it always returns 0, whichever is chosen,

CodePudding user response:

int now=GetCurSel ();
DWORD st=TCIS_HIGHLIGHTED;
SetItemState (now, TCIF_STATE, st);//TCIS_BUTTONPRESSED
DWORD state=GetItemState (now, TCIF_STATE);
AfxDump & lt;

CodePudding user response:

custom painting CTabCtrl controls the implementation of the
  • Related