Print Page | Close Window

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

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=10925
Printed Date: 21 November 2024 at 1:22pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to make CXTHeaderCtr::DrawItem() be called?
Posted By: amzheng
Subject: How to make CXTHeaderCtr::DrawItem() be called?
Date 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



Replies:
Posted By: Oleg
Date 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


Posted By: amzheng
Date 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


Posted By: amzheng
Date 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


Posted By: amzheng
Date Posted: 09 June 2008 at 7:32pm
I've solved it. Thanks.

-------------
Emily



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net