WM_DRAWITEM does not process for tab control
-
Thanks for ur help I created a dialog based application. I selected a tab control and moved to my dialog . I have created an MFC class named CMyTabCtrl derived from CTabCtrl. I added ur code to it. I created a member variable in the dialog class for the tab control using class wizard which is CMyTabCtrl m_Tab I have selected the owner draw fixed properties But still the drawitem of CMyTabCtrl does not called. Please implement this and if u r getting let me know what u did.
I did the same - I used a DDX_Control() call in DoDataExchange() to subclass the control...
void CMyDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_TAB1, m_Tab); <-- make sure you use the right ID!!!
}Mark Salsbery Microsoft MVP - Visual C++ :java:
-
I did the same - I used a DDX_Control() call in DoDataExchange() to subclass the control...
void CMyDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_TAB1, m_Tab); <-- make sure you use the right ID!!!
}Mark Salsbery Microsoft MVP - Visual C++ :java:
I have done that. But still does not work Can u send me ur sample project.
-
I have done that. But still does not work Can u send me ur sample project.
It's a VS2008 project - is that OK?
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
It's a VS2008 project - is that OK?
Mark Salsbery Microsoft MVP - Visual C++ :java:
ok
-
The following code works for me... Note you have to have a tab control subclassed by an object of your CTabCtrl-derived class, otherwise DrawItem() will never get called...
class CMyTabCtrl : public CTabCtrl
{
public:
CMyTabCtrl() : CTabCtrl() {}virtual void DrawItem(LPDRAWITEMSTRUCT /\*lpDrawItemStruct\*/);
};
void CMyTabCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CDC dc;
dc.Attach(lpDrawItemStruct->hDC);// Note: My test tab control has two tabs inserted :) if (0 == lpDrawItemStruct->itemID) dc.DrawText(\_T("Tab 1"), &lpDrawItemStruct->rcItem, DT\_CENTER); else dc.DrawText(\_T("Tab 2"), &lpDrawItemStruct->rcItem, DT\_CENTER); dc.Detach();
}
Mark Salsbery Microsoft MVP - Visual C++ :java:
Am I doing anything wrong in setting the properties of the tab control. Shall I send the sample code.
-
Am I doing anything wrong in setting the properties of the tab control. Shall I send the sample code.
It seems like you're doing everything.... Send me an email from here and I'll reply with the project. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
It seems like you're doing everything.... Send me an email from here and I'll reply with the project. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
I am waiting for ur reply
-
It seems like you're doing everything.... Send me an email from here and I'll reply with the project. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
It works now when i call insert item Thanks
-
It works now when i call insert item Thanks
Ohhh you had no tabs :) I guess the email through CodeProject isn't working yet....I sent one so I could get your address to send the project. Glad you got it working! Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Ohhh you had no tabs :) I guess the email through CodeProject isn't working yet....I sent one so I could get your address to send the project. Glad you got it working! Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
Thanks for ur support
-
Thanks for ur support
You're welcome!
Mark Salsbery Microsoft MVP - Visual C++ :java: