将子项从listview复制到剪贴板

时间:2015-12-02 18:14:27

标签: c# listview copy

我有一个程序,允许用户将信息上传到数据库以进行代码调试。上载初始代码,然后显示在列表视图中。我试图想办法复制单个数据单元格,特别是“代码”单元格,所以当用户点击单元格时,他们只能复制该代码,而不是整行。

我尝试过使用labeledit,但是这允许在整个表单上进行编辑,这不是我想要的功能。除了代码单元之外,我想要锁定单元格,但只允许从该单元格中复制。

以下是我的列表视图的准备工作。

InitializeListView

add_index :slugs, :slug, unique: true

PopulateListView

 private void InitializeListView()
        {
            // Set the view to show details.
            lbxBugged.View = View.Details;


            // Allow the user to rearrange columns.
            lbxBugged.AllowColumnReorder = true;

            // Select the item and subitems when selection is made.
            lbxBugged.FullRowSelect = true;

            // Display grid lines.
            lbxBugged.GridLines = true;

            // Sort the items in the list in ascending order.
            lbxBugged.Sorting = SortOrder.Ascending;

            // Attach Subitems to the ListView
            lbxBugged.Columns.Add("ID", 70, HorizontalAlignment.Left);
            lbxBugged.Columns.Add("Code", 300, HorizontalAlignment.Left);
            lbxBugged.Columns.Add("Description", 200, HorizontalAlignment.Left);
            lbxBugged.Columns.Add("Author", 120, HorizontalAlignment.Left);
        }

0 个答案:

没有答案
相关问题