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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chensuCommented:
What the Windows Explorer uses is a rebar control that hosts a tree view control. You may use Spy++ to verify it.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.