Reputation: 12842
Is it possible to access information about the text selection within an editable TreeNode
of a WinForms TreeView
?
I discovered methods such as BeginEdit()
and EndEdit(bool cancel)
, but I need finer granularity of control -- something like TextBoxBase.SelectionStart
and SelectionLength
properties, but on the node itself.
Is this possible in C#/.Net?
Upvotes: 2
Views: 600
Reputation: 62387
You will need to do some native interop work to get the edit control that is used for the label. To get this control, you need to use the TVM_GETEDITCONTROL
message, sending it to the tree view instance in which you want this behavior.
Once you have the window handle from this message, you can then use the EM_SETSEL
message on the handle to set the selection.
Upvotes: 2