private void listView_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ListView listview = (ListView)sender;
            ListViewItem lstrow = listview.GetItemAt(e.X, e.Y);
            System.Windows.Forms.ListViewItem.ListViewSubItem lstcol = lstrow.GetSubItemAt(e.X, e.Y);
            string strText = lstcol.Text;
            try
            {
                Clipboard.SetDataObject(strText);
                notifyIcon1.Visible = true;
                string info = string.Format("内容【{0}】已经复制到剪贴板", strText);
                notifyIcon1.ShowBalloonTip(1500, "提示", info, ToolTipIcon.Info);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }


图示:双击“塑胶工程师”单元格会将内容复制到剪贴板中,并在右下角冒泡提示(使用NotifyIcon时必须设置ICON属性,否则不显示)

C# Winform ListView实现单元格双击复制内容到剪贴板

相关文章:

  • 2021-07-25
  • 2022-03-01
  • 2021-06-30
  • 2021-12-03
  • 2021-06-11
  • 2022-12-23
猜你喜欢
  • 2021-12-03
  • 2021-12-19
  • 2022-12-23
  • 2021-12-03
  • 2021-12-19
  • 2021-04-18
  • 2021-06-05
相关资源
相似解决方案