コード例 #1
0
ファイル: FormBookmarks.cs プロジェクト: meto4d/SpeechCastNT
        private void listView_DragDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(typeof(DrapDropItem)))
            {
                DrapDropItem data = (DrapDropItem)e.Data.GetData(typeof(DrapDropItem));

                ListViewItem item = GetListViewItem(e.X, e.Y);
                if (item != null)
                {
                    Bookmarks.BookmarkBase bookmark = item.Tag as Bookmarks.BookmarkBase;
                    if (bookmark != null)
                    {
                        if (data.Items.IndexOf(bookmark) < 0)
                        {
                            foreach (Bookmarks.BookmarkBase b in data.Items)
                            {
                                data.Folder.Items.Remove(b);
                            }

                            int index = data.Folder.Items.IndexOf(bookmark);

                            foreach (Bookmarks.BookmarkBase b in data.Items)
                            {
                                data.Folder.Items.Insert(index, b);
                            }

                            UpdateTreeView();
                            SelectNode(data.Folder);
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: FormBookmarks.cs プロジェクト: meto4d/SpeechCastNT
        private void listView_ItemDrag(object sender, ItemDragEventArgs e)
        {
            if (listView.SelectedItems.Count > 0 && e.Button == MouseButtons.Left)
            {
                DrapDropItem dragDropItem = new DrapDropItem();

                TreeNode selectedNode = treeView.SelectedNode;

                if (selectedNode != null)
                {
                    Bookmarks.Folder folder = selectedNode.Tag as Bookmarks.Folder;
                    if (folder != null)
                    {
                        foreach (ListViewItem item in listView.SelectedItems)
                        {
                            Bookmarks.BookmarkBase bb = item.Tag as Bookmarks.BookmarkBase;

                            if (bb != null)
                            {
                                dragDropItem.Items.Add(bb);
                            }
                        }

                        dragDropItem.Folder = folder;
                        treeView.DoDragDrop(dragDropItem, DragDropEffects.Move);
                    }
                }
            }
        }
コード例 #3
0
ファイル: FormBookmarks.cs プロジェクト: meto4d/SpeechCastNT
        private void toolStripMenuItemDelete_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = treeView.SelectedNode;

            if (selectedNode != null)
            {
                Bookmarks.Folder folder = selectedNode.Tag as Bookmarks.Folder;
                if (folder != null)
                {
                    foreach (ListViewItem item in listView.SelectedItems)
                    {
                        Bookmarks.BookmarkBase bb = item.Tag as Bookmarks.BookmarkBase;

                        if (bb != null)
                        {
                            folder.Items.Remove(bb);
                        }
                    }

                    UpdateTreeView();
                    SelectNode(folder);
                }
            }
        }