Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you are only copying and pasting within your application, you can map the cut/copy operation of your treeview to a method that just clones your selected node. Ie:</p> <pre><code>TreeNode selectedNode; TreeNode copiedNode; selectedNode = yourTreeview.SelectedNode; if (selectedNode != null) { copiedNode = selectedNode.Clone; } // Then you can do whatever you like with copiedNode elsewhere in your app. </code></pre> <p>If you are wanting to be able to paste to other applications, then you'll have to use the clipboard. You can get a bit fancier than just plain text by learning more about the <strong>IDataObject</strong> interface. I can't remember the source but here's something I had in my own notes:</p> <blockquote> <p>When implemented in a class, the IDataObject methods allow the user to store data in multiple formats in an instance of the class. Storing data in more than one format increases the chance that a target application, whose format requirements you might not know, can retrieve the stored data. To store data in an instance of IDataObject, call the SetData method and specify the data format in the format parameter. Set the autoConvert parameter to false if you do not want stored data to be converted to another format when it is retrieved. Invoke SetData multiple times on one instance of IDataObject to store data in more than one format.</p> </blockquote> <p>Once you've populated an object that implements <strong>IDataObject</strong> (e.g. something called <strong>yourTreeNodeDataObject</strong>), then you can call:</p> <pre><code>Clipboard.SetDataObjecT(yourTreeNodeDataObject); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload