How to add a custom title bar to CTreeView

I have a program that I want to look similar to windows explorer with a tree view and then a box in that same view that says "Folders".  It's not the application title but looks more like a button or a custom title bar.

Does anyone have a suggestion?  I would like to use CTreeView and override the Paint method.  Right now I can override the Paint method and draw the box but I cannot get the tree control to draw.

Thanks,

Jordan
jordan_pAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
chensuConnect With a Mentor Commented:
What the Windows Explorer uses is a rebar control that hosts a tree view control. You may use Spy++ to verify it.
0
 
jordan_pAuthor Commented:
Can I do it without using Windows Explorer rebars?  I don't want to have to rely on Microsoft Internet Explorer 3.0 or above being installed on the machine.
0
 
chensuCommented:
You can create a parent window which hosts the tree view control and a static control. A static control with some extended styles looks like what you want.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
jordan_pAuthor Commented:
I actually already did that already and it worked fine.  But it didn't behave like a CTreeView.  I was unable to catch the messages from the CTreeCtrl in my new view class.  I guess I can catch the messages in a new class that derived from CTreeCtrl but than I'm unable to have the code I need at the View level.

Any suggestions?
0
 
chensuCommented:
Yeah, that's because the parent window of CTreeCtrl is the window that hosts it instead of the view. You may either try to create the static control from the view or let the parent window of CTreeCtrl forward all the messages to the view.
0
 
jordan_pAuthor Commented:
Can I override the OnPaint() method in a derived CTreeView class and draw both the TreeCtrl and the title box?
0
 
jordan_pAuthor Commented:
Can I also use this same method of overriding the OnPaint() method to create a title box on a CEditView or a CFormView?
0
 
chensuCommented:
That's not practical because you occupy some part of the control and you have to draw it yourself.
0
 
jordan_pAuthor Commented:
I ended up using a CView with a derived CEditCtrl.  I overrode the Paint method to draw a title box on the top and the CEditCtrl on the bottom.
0
All Courses

From novice to tech pro — start learning today.