Solved

about the an example code on codeguru

Posted on 1998-01-04
2
413 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
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Powershell based monitoring system 2 127
Unix / Linux grid computing 5 127
Tab names are off by one 5 49
tripleUp challenge 7 66
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa‚Ķ
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now