Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image in a CHeaderCtrl

Status
Not open for further replies.

CMR

Programmer
Apr 30, 2002
76
AU

Anyone know if I can replace the text in a CHeaderCtrl above a CListCtrl with an image?

Thanks

CMR
 
Sure. In fact, you can use either a bitmap, or you can associate an image list with the header control and display images from that in the header. You can have images, text, or both displayed in the header. If you feel like getting really fancy, you can even draw it yourself.

Quick start:
Use CListCtrl::GetHeaderCtrl() to retrieve a pointer to a CHeaderCtrl object. Then call CHeaderCtrl::InsertItem() (or CHeaderCtrl::SetItem() if you've already added items) to set a bitmap. If you want to use an image list, you'll need to associate it with the control first by calling CHeaderCtrl::SetImageList().
 

This would be absolutely perfect - if I was using VC++6. Unfortunately I'm using VC++5 (sorry, I should have mentioned this) so the only thing I can't do here is get a pointer to my header control as CListCtrl::GetHeaderCtrl() was added in V6.

If you know any other way I can get to the header control that would be great.

Thanks again

CMR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top