當前位置: 首頁>>代碼示例>>C#>>正文


C# Forms.ItemDragEventArgs類代碼示例

本文整理匯總了C#中System.Windows.Forms.ItemDragEventArgs的典型用法代碼示例。如果您正苦於以下問題:C# ItemDragEventArgs類的具體用法?C# ItemDragEventArgs怎麽用?C# ItemDragEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ItemDragEventArgs類屬於System.Windows.Forms命名空間,在下文中一共展示了ItemDragEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: treeView1_ItemDrag

        private void treeView1_ItemDrag(object sender, ItemDragEventArgs e)
        {
            // gx2. jsx, jsc reflector
            // ?

            // http://support.microsoft.com/kb/307968

            // we can drag it into scite
            // DragDrop.DoDragDrop returns only after the complete drag-drop process is finished,
            // http://w3facility.org/question/dodragdrop-freezes-winforms-app-sometimes/
            // https://msdn.microsoft.com/en-us/library/ms649011(VS.85).aspx

            // http://www.codeproject.com/Articles/17266/Drag-and-Drop-Items-in-a-WPF-ListView

            Console.WriteLine("treeView1_ItemDrag"); ;

            // http://stackoverflow.com/questions/1772102/c-sharp-drag-and-drop-from-my-custom-app-to-notepad
            var x = new DataObject(
                "treeView1_ItemDrag " + new { e.Item }
            );


            // like props/ reg keys/ version nodes
            x.SetData("text/nodes/0", "hello");
            x.SetData("text/nodes/1", "world");

            // https://msdn.microsoft.com/en-us/library/system.windows.forms.control.dodragdrop(v=vs.110).aspx
            //this.DoDragDrop("treeView1_ItemDrag " + new { e.Item }, DragDropEffects.Copy);
            treeView1.DoDragDrop(x, DragDropEffects.Copy);

            // https://code.google.com/p/chromium/issues/detail?id=31037
            // https://searchcode.com/codesearch/view/32985148/
        }
開發者ID:exaphaser,項目名稱:JSC-Cross-Compiler,代碼行數:33,代碼來源:ApplicationControl.cs

示例2: OnItemDrag

        protected override void OnItemDrag(ItemDragEventArgs e)
        {
            //Begins a drag-and-drop operation in the ListView control.
            this.DoDragDrop(this.SelectedItems, DragDropEffects.Move);

            base.OnItemDrag(e);
        }
開發者ID:memerdot,項目名稱:puyotools-1,代碼行數:7,代碼來源:ListViewWithReordering.cs

示例3: ItemDrag

        /// <summary>
        /// This method initialises the dragging of a ListViewItem
        /// </summary>
        void ItemDrag(object sender, ItemDragEventArgs e)
        {
            ReleaseCom();

            startButton = e.Button;

            FileSystemInfo[] items = listView.GetSelected();

            List<ShellItem> list = new List<ShellItem>();
            foreach (FileSystemInfo f in items)
            {
                //IntPtr[] pidls = ShellFolder.GetPIDLs(items);
                IntPtr pidl = ShellFolder.GetPathPIDL(f);
                //IShellFolder parentShellFolder = ShellFolder.GetParentShellFolder(items[0]);
                string parentDirectory = ShellFolder.GetParentDirectoryPath(f);
                IntPtr parentShellFolder = ShellFolder.GetShellFolderIntPtr(parentDirectory);


                ShellItem item = new ShellItem(browser, pidl, parentShellFolder);
                list.Add(item);
            }

            dataObjectPtr = ShellHelper.GetIDataObject(list.ToArray());

            if (dataObjectPtr != IntPtr.Zero)
            {
                DragDropEffects effects;
                //OnDragStart(new DragEnterEventArgs((items[0].ParentItem != null ? items[0].ParentItem : items[0]), fileView.ListView));
                ShellAPI.DoDragDrop(dataObjectPtr, this, DragDropEffects.Copy | DragDropEffects.Link | DragDropEffects.Move, out effects);
                //OnDragEnd(new EventArgs());
            }
        }
開發者ID:shankithegreat,項目名稱:commanderdotnet,代碼行數:35,代碼來源:BrowserDragWrappers.cs

示例4: stencilChooserTreeView_ItemDrag

 private void stencilChooserTreeView_ItemDrag(object sender, ItemDragEventArgs e)
 {
   ModelStencil modelStencil;
   if (modelStencils.TryGetValue(((TreeNode)e.Item).Text, out modelStencil))
   {
     this.DoDragDrop(modelStencil, DragDropEffects.Move);
   }
 }
開發者ID:ChrisMoreton,項目名稱:Test3,代碼行數:8,代碼來源:StencilChooser.cs

示例5: OnItemDrag

 protected override void OnItemDrag(ItemDragEventArgs e)
 {
     // can't drag the root node
     if (!base.SelectedNodes.Contains(base.Nodes[0]))
         DoDragDrop(BeginDragNodes(base.SelectedNodes), DragDropEffects.All);
     else
         base.OnItemDrag(e);
 }
開發者ID:ImaginationSydney,項目名稱:flashdevelop,代碼行數:8,代碼來源:DragDropTreeView.cs

示例6: treeView_ItemDrag

        private void treeView_ItemDrag(object sender, ItemDragEventArgs e)
        {
            Debug.WriteLine("\t Source Tree Item Dragged... ");

            if (e.Button == MouseButtons.Left)
            {
                treeView.DoDragDrop(e.Item.ToString(), DragDropEffects.Copy | DragDropEffects.All);
            }
        }
開發者ID:WeDoCrm,項目名稱:MessengerSocket,代碼行數:9,代碼來源:SourceForm.cs

示例7: _folders_ItemDrag

		private void _folders_ItemDrag(object sender, ItemDragEventArgs e)
		{
			// allow dragging of nodes
			var selection = (ISelection)e.Item;

			// send the node
			if (selection.Item != null)
				_folders.DoDragDrop(selection.Item, DragDropEffects.Move);
		}
開發者ID:nhannd,項目名稱:Xian,代碼行數:9,代碼來源:FolderExplorerConfigurationComponentControl.cs

示例8: OnItemDrag

    //protected override void WndProc(ref System.Windows.Forms.Message m)
    //{
    //  const int WM_PAINT = 0xf ;

    //  switch(m.Msg)
    //  {
    //    case WM_PAINT:
    //      if(this.View == System.Windows.Forms.View.Details && this.Columns.Count > 0)
    //      {
    //        this.Columns[this.Columns.Count - 1].Width = -2 ;
    //      }
    //      break ;
    //  }

    //  base.WndProc (ref m);
    //}

    protected override void OnItemDrag(ItemDragEventArgs e)
    {
      if (!this.AllowRowReorder)
      {
        return;
      }
      base.DoDragDrop(REORDER, DragDropEffects.Move);
      base.OnItemDrag(e);
    }
開發者ID:arangas,項目名稱:MediaPortal-1,代碼行數:26,代碼來源:MPListView.cs

示例9: listView1_ItemDrag

        private void listView1_ItemDrag(object sender, ItemDragEventArgs e)
        {
            if (e.Item is ListViewItem)
            {
                var listViewItem = e.Item as ListViewItem;

                if (!string.IsNullOrEmpty(listViewItem.Text))
                    DoDragDrop(new DragItem(listViewItem.Text), DragDropEffects.Copy);
            }
        }
開發者ID:ibrahimbensalah,項目名稱:XmallSteps,代碼行數:10,代碼來源:ToolBoxControl.cs

示例10: CourseTree_ItemDrag

        private void CourseTree_ItemDrag(object sender, ItemDragEventArgs e)
        {
            if (EditorObserver.HostEditorMode == Utils.Controls.HtmlEditing.Enums.HtmlEditingToolMode.Design)
            {
                dragNode = (TreeNode)e.Item;
                CourseTree.SelectedNode = dragNode;

                // Запрещено перемещать следующие узлы: 
                // корень учебной программы, входы, выходы, ответы, компетенции 
                // во входах, кроме внешних компетенций.
                if (!(dragNode is CourseRoot ||
                      dragNode is InConceptParent ||
                      dragNode is OutConceptParent ||
                      dragNode is Response ||
                      dragNode is InConceptParent &&
                      dragNode.Parent == CourseTree.InConceptsParent ||
                      dragNode is InDummyConcept &&
                      dragNode.Parent != CourseTree.InConceptsParent))
                {
                    //if (((CourseItem)dragNode).NodeType == Enums.ItemType.Question)
                    //{
                    //    question = (dragNode as Question);
                    //    priorParent = (dragNode.Parent as ECNode);
                    //}

                    dragImageList.Images.Clear();
                    if (dragNode.Bounds.Size.Width + CourseTree.Indent > 256)
                    {
                        dragImageList.ImageSize = new Size(256, dragNode.Bounds.Height);
                    }
                    else
                    {
                        dragImageList.ImageSize = new Size(dragNode.Bounds.Size.Width + CourseTree.Indent,
                                                           dragNode.Bounds.Height);
                    }
                    var bmp = new Bitmap(dragNode.Bounds.Width + CourseTree.Indent, dragNode.Bounds.Height);
                    var g = Graphics.FromImage(bmp);
                    g.DrawString(dragNode.Text, CourseTree.Font, new SolidBrush(CourseTree.ForeColor), CourseTree.Indent,
                                 1.0f);
                    dragImageList.Images.Add(bmp);
                    var p = CourseTree.PointToClient(Control.MousePosition);
                    var dx = p.X + CourseTree.Indent - dragNode.Bounds.Left;
                    var dy = p.Y - dragNode.Bounds.Top;
                    if (DragHelper.ImageList_BeginDrag(dragImageList.Handle, 0, dx, dy))
                    {
                        CourseTree.DoDragDrop(bmp, DragDropEffects.Move);
                        DragHelper.ImageList_EndDrag();
                    }
                }
            }
        }
開發者ID:AlexGaidukov,項目名稱:gipertest_streaming,代碼行數:51,代碼來源:CourseTreeDragDropHelper.cs

示例11: listView_ItemDrag

        private void listView_ItemDrag(object sender, ItemDragEventArgs e)
        {
            ListView listView = sender as ListView;
            if (listView == null)
                return;

            if (listView == lvDisplayedColumns && listView.SelectedItems.Contains(lvDisplayedColumns.Items[0]))
            {
                MessageBox.Show(this, string.Format("The \"{0}\" column can't be moved!", ((ColumnData)lvDisplayedColumns.Items[0].Tag).Header));
                return;
            }

            mDragStartListView = listView;
            mDragStartListView.DoDragDrop(listView.SelectedItems, DragDropEffects.Move | DragDropEffects.Copy);
        }
開發者ID:timmersuk,項目名稱:KSP-Mod-Admin-aOS,代碼行數:15,代碼來源:frmColumnSelection.cs

示例12: ItemDrag

        /// <summary>
        /// This method initialises the dragging of a TreeNode
        /// </summary>
        void ItemDrag(object sender, ItemDragEventArgs e)
        {
            ReleaseCom();

            startButton = e.Button;
            ShellItem item = (ShellItem)((TreeNode)e.Item).Tag;
            dataObjectPtr = ShellHelper.GetIDataObject(new ShellItem[] { item });

            if (dataObjectPtr != IntPtr.Zero)
            {
                DragDropEffects effects;
                OnDragStart(new DragEnterEventArgs((item.ParentItem != null ? item.ParentItem : item), br.FolderView));
                ShellAPI.DoDragDrop(dataObjectPtr, this, DragDropEffects.Copy | DragDropEffects.Link | DragDropEffects.Move, out effects);
                OnDragEnd(new EventArgs());
            }
        }
開發者ID:Alenochka17,項目名稱:laba3,代碼行數:19,代碼來源:BrowserDragWrappers.cs

示例13: ItemDragEvent

		// Used to start a drag
		protected void ItemDragEvent(object sender, ItemDragEventArgs e)
		{
			try {
				if (e.Item is IDragDropItem) {
					IDragDropItem node = (IDragDropItem)e.Item;
					node.SelectThisItem();

					if (node.IsDragSource) {
						// Not too elegant, but we might be dragging
						// controls to the design surface
						DesignerHost.Host.AddingControls = true;
						((Control)_control).DoDragDrop(node, DragDropEffects.Copy);
						DesignerHost.Host.AddingControls = false;
					}
				}
			} catch (Exception ex) {
				TraceUtil.WriteLineWarning(this, "ItemDragEvent exception: " + ex);
			}
		}
開發者ID:2594636985,項目名稱:SharpDevelop,代碼行數:20,代碼來源:DragDropSupport.cs

示例14: listViewResults_ItemDrag

        private void listViewResults_ItemDrag(object sender, ItemDragEventArgs e)
        {
            List<int> cardIDs = new List<int>();

            foreach (ListViewItem item in listViewResults.SelectedItems)
            {
                if(item is IDListViewItem)
                    cardIDs.Add(((IDListViewItem)item).ID);
            }

            if (cardIDs.Count > 0)
            {
                LanguageData dataLayer = new LanguageData();
                string description = string.Empty;

                foreach (dsLanguageData.CardRow card in dataLayer.GetCardsByIDs(cardIDs))
                {
                    description += ", " + card.Question;
                }
                description = description.Remove(0, 2);

                DoDragDrop(new CardDragDropHolder(this, cardIDs, description, CardDragDropAction.Add), DragDropEffects.All);
            }
        }
開發者ID:eneifert,項目名稱:LanguageLearner,代碼行數:24,代碼來源:CardSearchControl.cs

示例15: treLifestyles_ItemDrag

 private void treLifestyles_ItemDrag(object sender, ItemDragEventArgs e)
 {
     try
     {
         if (treLifestyles.SelectedNode.Level != 1)
             return;
     }
     catch
     {
         return;
     }
     _intDragLevel = treLifestyles.SelectedNode.Level;
     DoDragDrop(e.Item, DragDropEffects.Move);
 }
開發者ID:cormanater,項目名稱:chummer5a,代碼行數:14,代碼來源:frmCreate.cs


注:本文中的System.Windows.Forms.ItemDragEventArgs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。