Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - How to make CXTHeaderCtr::DrawItem() be called?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to make CXTHeaderCtr::DrawItem() be called?

 Post Reply Post Reply
Author
Message
amzheng View Drop Down
Newbie
Newbie
Avatar

Joined: 05 June 2008
Location: Canada
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote amzheng Quote  Post ReplyReply Direct Link To This Post Topic: How to make CXTHeaderCtr::DrawItem() be called?
    Posted: 05 June 2008 at 1:22pm

I have a class derived from MFC class CHeaderCtrl with DrawItem() function overrided.
I set its HDI_ITEM variable hdi.fmt = HDF_CENTER | HDF_STRING | HDF_OWNERDRAW;
My DrawItem() function works before I changed to CXTHeaderCtrl.

Now I use CXTHeaderCtrl instead of CHeaderCtrl, and then my DrawItem() function is not being called anymore.
Can anybody tell me that how I can make DrawItem() being called when using CXTHeaderCtrl?

Thanks in advance.

Emily
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 06 June 2008 at 1:15am
Hello,
 
Its not called from CXTHeaderCtrl. to support custom themes CXTHeaderCtrl catch WM_PAINT and draw all header manually.
 
See XTHeaderCtrlTheme.cpp file - you can derive from CXTHeaderCtrlTheme and override some methods.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
amzheng View Drop Down
Newbie
Newbie
Avatar

Joined: 05 June 2008
Location: Canada
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote amzheng Quote  Post ReplyReply Direct Link To This Post Posted: 06 June 2008 at 7:00pm
I create a small program following your idea. Yeah, override some draw function of CXTHeaderCtrlTheme make it works. Thanks a lot, Oleg.
 
 
Emily
Back to Top
amzheng View Drop Down
Newbie
Newbie
Avatar

Joined: 05 June 2008
Location: Canada
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote amzheng Quote  Post ReplyReply Direct Link To This Post Posted: 09 June 2008 at 5:08pm
I made an override function of CXTHeaderCtrlTheme::DrawHeader(), now it works fine. But there is a problem, when I right click on my header column, it always pop up a menu, it has "Sort Ascending", "Sort Descending" and "Alignment" with submenus, even if I did not create this menu. I want to get rid of this popup menu, and put my popup menu there, how can I get rid of this menu? Thanks in advance.
Emily
Back to Top
amzheng View Drop Down
Newbie
Newbie
Avatar

Joined: 05 June 2008
Location: Canada
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote amzheng Quote  Post ReplyReply Direct Link To This Post Posted: 09 June 2008 at 7:32pm
I've solved it. Thanks.
Emily
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.218 seconds.