I guess this only works if your tree control is embedded directly in the mainframe? I can see that my TreeView is still getting the Custom Tree Control message but I haven't figured out how to overwrite the notifications in that case?
This is really a very good code. but tell me, how can i add list view for the same to the right side of the window. ??
vishal sir plz contact me, paras from indore
Posted by thematrix4u
on 12/17/2008 01:51am
hello vishal sir,
i donot know that this mail will reach to u or not,
but sir kindly contact me this is an emergancy,,,
i m paras patidar from indore..
Dr. Rama's family friend..
i tried ur no. but it is not in service..
contact me at +91-9009784488
plz sir i need to talk somthing important to u for both of us.
I've seen several posts here about changing the item rect when doing a custom draw, and in fact it was searching for that information that led me to this page in the first place. I've had luck with one ... not a solution, more like a work-around.
It's pretty simple to implement -- just increase the TreeCtrl Indent by the size of your icon, then in the custom draw function, offset your item rectangle by the same amount in the other direction:
// when initializing CTreeCtrl, assuming icon width of 16
MyTree.SetIndent(MyTree.GetIndent() + 16);
// inside CustomDraw function
HTREEITEM hti = (HTREEITEM)nmcd.dwItemSpec;
GetItemRect(hti, &itemRect, TRUE);
// only reverse the indent offset if this is a child item
if (GetParentItem(hti) != TVI_ROOT && GetParentItem(hti) != NULL)
::OffsetRect(&itemRect, -16, 0);
ActiveX hosting, events from contained components are fired through to your program using the exact same model used in VB6 for components added at run time, data bounding, multiple columns, and more
In case you don't get a CDDS_ITEMPREPAINT message after returning CDRF_NOTIFYITEMDRAW to the CDDS_PREPAINT, you can try to set SetWindowLong(hDlg,DWL_MSGRESULT,CDRF_NOTIFYITEMDRAW); in case you have a dialog box.
The Custom-Draw-TreeCtrl works fine. But now I want to set the width of each item, so I can draw something instead of text. The main problem is, that the scroll-bar will only notice the width of the text, but I want to set a user-defined width. Is this possible ?