Click here to Skip to main content
15,905,967 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to create a list control which could hold buttons. How to put CButton class object into a list control?
Posted

This can't be answered in short. You may have a look on the sources of CListCtrl derived classes using owner draw. They usually add edit fields, check buttons, and combo boxes to cells.

See the CP article CGridListCtrlEx - Grid Control Based on CListCtrl[^] which also contains links to other articles.
 
Share this answer
 
Comments
wzzz12321 11-Jul-12 5:22am    
Thanks for your answer! I'm a novice programmer. The article you recommend is really an huge project. Could you show me some articles less complicated?
Jochen Arndt 11-Jul-12 5:41am    
See the links to the other articles on top. Some may be smaller. However, implementing owner draw for Windows controls is an advanced topic that can't be handled by a few lines of code.

A simple example to change the background color of list cells can be found at http://www.codeguru.com/Cpp/controls/listview/backgroundcolorandimage/article.php/c4181/. In that example you may add drawing of a dynamically created button for specific cells inside the last case statement and return CDRF_SKIPDEFAULT to suppress the default drawing of the cell.
wzzz12321 11-Jul-12 6:00am    
I will read the article a moment later.Thank you very much!
could someone help me with this? I would be great appreciate it
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900