我想使用ContextMenuStrip右键单击获取Listview.selectedItem的文本并复制到剪贴板
答案 0 :(得分:0)
首先将ContextmenuStrip添加到Listview
Dim cm As ContextMenuStrip = cms_Listview
ListView1.ContextMenuStrip = cm
然后只需将ToolStripMenuItem.click事件中的选定列表视图项复制到剪贴板
Private Sub tsmi_copy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsmi_copy.Click
If ListView1.SelectedItems.Count = 0 Then Exit Sub
Clipboard.Clear()
Clipboard.SetText(ListView1.SelectedItems(0).Text)
End Sub