|
Hi ,
I want to have a treeview where in each node will have a TableLayoutPanel with 1 Row and many columns instead of just a label. For this I have set the DrawMode property of the Treeview to OwnerDrawText. I have the Table which is to be displayed within the tag property of the TreeNode Object. Can anyone guide me (pointers or links to articles) to get this done. I tried to handle the DrawNode Event but could not understand as to how to draw a TableLoyout Panel at the given place.. |
| Bharath_See Wednesday, September 02, 2009 2:37 PM |
This is not possible, you can only draw with the Graphics class. Using controls is not going to work. You are also limited by the bounds of the node. You can widen it by setting the TreeNode.Text property to a large string. Almost all third-party control vendors have a enriched substitute for TreeView. They typically call it TreeList.
Hans Passant.- Marked As Answer byLing WangMSFT, ModeratorWednesday, September 09, 2009 1:07 PM
-
|
| nobugz Wednesday, September 02, 2009 9:07 PM |
The bounds are passed to the DrawItem event handler. There is no way to change them afterwards, TreeView calculates them from the height of the Font and the width of the Text.
Hans Passant.- Marked As Answer byLing WangMSFT, ModeratorWednesday, September 09, 2009 1:07 PM
-
|
| nobugz Thursday, September 03, 2009 11:13 AM |
I think it would be too tough for you. why you don't try to datagridview with parent-child relations. |
| AUmidh Wednesday, September 02, 2009 2:45 PM |
This is not possible, you can only draw with the Graphics class. Using controls is not going to work. You are also limited by the bounds of the node. You can widen it by setting the TreeNode.Text property to a large string. Almost all third-party control vendors have a enriched substitute for TreeView. They typically call it TreeList.
Hans Passant.- Marked As Answer byLing WangMSFT, ModeratorWednesday, September 09, 2009 1:07 PM
-
|
| nobugz Wednesday, September 02, 2009 9:07 PM |
How to Increase the Bounds of TreeNode other than by setting text to a large value..I tried , however looked into treenode Members and found that it does not have a set bounds property..Is there any way maybe by inheriting the from the TreeNode class to override and increase the Bounds ?? |
| Bharath_See Thursday, September 03, 2009 8:22 AM |
The bounds are passed to the DrawItem event handler. There is no way to change them afterwards, TreeView calculates them from the height of the Font and the width of the Text.
Hans Passant.- Marked As Answer byLing WangMSFT, ModeratorWednesday, September 09, 2009 1:07 PM
-
|
| nobugz Thursday, September 03, 2009 11:13 AM |
Hello nobugz, Thanks for the reply.. So if i handle the DrawItem event handler then there can i increase the bounds of the TreeNode.. Also I would like to increase the size the width of the hightlight region of the node so that the text I draw next to the Node's Text is also hightlighted when node is selected..How do I go about to accomplish this ?? |
| Bharath_See Monday, September 07, 2009 2:06 PM |
You are not paying attention to my posts. You can NOT change the bounds in the DrawItem event handler. They are fixed, based on the font size (height) and the length of the node text (width). The standard TreeView control cannot provide what you need.
Hans Passant. |
| nobugz Monday, September 07, 2009 2:24 PM |
Thanks .. Got what you said.. |
| Bharath_See Monday, September 14, 2009 2:50 AM |