>> The Control class offers a ContextMenuStrip so that you can assign a menu
>> to be automatically displayed when the control is right-clicked. That's
[quoted text clipped - 3 lines]
> Actually, they do. See `TreeView.HitTest' and `TreeView.GetNodeAt'
> methods.
No, that's not what I call easy; that's the code I'm expecting to have to
write. I think the tree view control should provide ContextMenuTarget and
ContextMenuTargetType properties which I can just reference directly from
the Click event of the menu item.
Alex Blekhman - 13 Dec 2007 20:25 GMT
>> Actually, they do. See `TreeView.HitTest' and
>> `TreeView.GetNodeAt' methods.
[quoted text clipped - 4 lines]
> properties which I can just reference directly from the
> Click event of the menu item.
But what if you need to display different context menus for
different tree nodes? Also, don't forget that WinForms
controls are rather thin wrappers on top of Win32 common
controls. So, they expose whatever underlying native control
delivers. Sometimes even less (see my rants in
"Icon.FromHandle + ImageList = decreased color depth"
thread, for example).
Alex