Solved

about the an example code on codeguru

Posted on 1998-01-04
2
426 Views
Last Modified: 2013-11-20
On www.codeguru.com,there is a topic concerned on changing the background color of treeview.In the example code,it does something on the OnPaint of CTreeCtrl.(http://www.codeguru.com/treeview/ctrl_color.shtml)But I really don't know how can I handle the CTreeCtrl's OnPaint()in CTreeView,what I can handle is only the OnPaint() os CTreeView,but that does nothing usefull.any one who have already read the topic in codeguru can give me some advice?How can I handle the OnPaint() of CTreeCtrl in a CTreeView?

thanks
0
Comment
Question by:yuqiang
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
richhxb earned 10 total points
ID: 1313423
Use CTreeView::GetTreeCtrl to get a reference of the tree
control associated with the view, then create your own
CTreeCtrl class, and in your own CMyTreeCtrl, use
SubclassWindow(m_MyTreeView.GetTreeCtrl()->m_hWnd) to
subclass it.

Now you can handle the OnPaint() of CTreeCtrl in your
CTreeView.



0
 

Author Comment

by:yuqiang
ID: 1313424
hi,richhxb,

thank you for your kindly answer.But when I tried under your diction,I got an ASSERT failure in wincore.cpp line 315.It seem that the treectrl has already been attach to the treeview(treeview.m_hWnd == treectrl.m_hWnd),so the treectrl can not be attach to the CMyTreeCtrl.

Since the CTreeView and the CTreeCtrl has the same m_hWnd,does all the message sent to the CTreeCtrl is sent to the CTreeView? If it is true,the CTreeView's OnPaint() is equal to CTreeCtrl's OnPaint(),But why I can not get the desired result by handle the CTreeView's OnPaint()? Would you so kind have a look at http://www.codeguru.com/treeview/ctrl_color.shtml and give me some advice?I can not contact with the author of that URL.

If you like ,you can  give me email directly.(yuq@wayx.com)

thank you again.

0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Creating Labels and Frequency list style reports in SAS code 9 130
Generic progress indicator 6 121
haveThree challenge 22 128
Use of condition with 'serial' in ansible 2 103
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question