Exemple #1
0
 private void CopySelectedTreeViewNodeToClipboard(TreeView tv)
 {
     if (tv != null && tv.SelectedNode != null)
     {
         Utilities.CopyTextToClipboard(tv.SelectedNode.Text);
     }
 }
 private void treeView_KeyUp(object sender, KeyEventArgs e)
 {
     if (dataSource != null && treeView.SelectedNode != null)
     {
         if (e.KeyCode == Keys.Delete && treeView.SelectedNode != treeView.Nodes[0])
         {
             dataSource.RemoveFiles(new string[1]
             {
                 treeView.SelectedNode.ToolTipText
             });
         }
         else if (e.KeyCode == Keys.C && e.Control)
         {
             Utilities.CopyTextToClipboard(treeView.SelectedNode.ToolTipText);
         }
     }
 }
Exemple #3
0
 private void CopySelectedListViewItemsToClipboard(ListView lv)
 {
     if (lv != null)
     {
         StringBuilder stringBuilder = new StringBuilder();
         foreach (ListViewItem selectedItem in lv.SelectedItems)
         {
             for (int i = 0; i < lv.Columns.Count; i++)
             {
                 if (i != 0)
                 {
                     stringBuilder.Append('\t');
                 }
                 stringBuilder.Append(selectedItem.SubItems[i].Text);
             }
             stringBuilder.AppendLine();
         }
         Utilities.CopyTextToClipboard(stringBuilder.ToString());
     }
 }