当前位置: 首页>>代码示例>>C#>>正文


C# DragEventArgs类代码示例

本文整理汇总了C#中DragEventArgs的典型用法代码示例。如果您正苦于以下问题:C# DragEventArgs类的具体用法?C# DragEventArgs怎么用?C# DragEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DragEventArgs类属于命名空间,在下文中一共展示了DragEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GroupBox_DragOver

	void GroupBox_DragOver (object sender, DragEventArgs e)
	{
		_eventsText.AppendText ("GroupBox => DragOver "
			+ _dragoverCount++.ToString (CultureInfo.InvariantCulture)
			+ Environment.NewLine);
		e.Effect = DragDropEffects.Move;
	}
开发者ID:mono,项目名称:gert,代码行数:7,代码来源:MainForm.cs

示例2: OnDragLeave

 void OnDragLeave(object sender, DragEventArgs e)
 {
     if (!IsMouseOverTreeView(e.GetPosition(TreeView)))
     {
         CleanUpAdorners();
     }
 }
开发者ID:YoshihiroIto,项目名称:TreeViewEx,代码行数:7,代码来源:DragNDropController.cs

示例3: DragEnter

        public void DragEnter(object sender, DragEventArgs e)
        {
            DragDropFlag = true;

            // choose single effect if there is only one in the allowedEffects flag
            e.Effects = DetermineDragDropEffect(e);
        }
开发者ID:jithuin,项目名称:infogeezer,代码行数:7,代码来源:DragDrop.cs

示例4: OnDragEnter

    protected override void OnDragEnter(DragEventArgs e)
    {
        base.OnDragEnter(e);

        if (!this.AllowRowReorder)
        {
            e.Effect = DragDropEffects.None;
            return;
        }

        if (!e.Data.GetDataPresent(DataFormats.Text))
        {
            e.Effect = DragDropEffects.None;
            return;
        }

        base.OnDragEnter(e);

        String text = (String)e.Data.GetData(REORDER.GetType());
        if (text.CompareTo(REORDER) == 0)
        {
            e.Effect = DragDropEffects.Move;
        }
        else
        {
            e.Effect = DragDropEffects.None;
        }
    }
开发者ID:dogmahtagram,项目名称:Finale,代码行数:28,代码来源:DragDropListView.cs

示例5: DragEventArgs

        /// <summary>
        /// Initializes a new instance of the DragEventArgs class.
        /// </summary>
        /// <param name="args">The DragEventArgs object to use as the base for
        /// this DragEventArgs.</param>
        internal DragEventArgs(DragEventArgs args)
        {
            Debug.Assert(args != null, "args must not be null.");

            this.AllowedEffects = args.AllowedEffects;
            this.MouseEventArgs = args.MouseEventArgs;
            this.Effects = args.Effects;
            this.Data = args.Data;
            this.OriginalSource = args.OriginalSource;
        }
开发者ID:shijiaxing,项目名称:SilverlightToolkit,代码行数:15,代码来源:DragEventArgs.cs

示例6: GroupBox_DragDrop

	void GroupBox_DragDrop (object sender, DragEventArgs e)
	{
		if (e.Data.GetDataPresent (DataFormats.FileDrop)) {
			string [] filenames = (string []) e.Data.GetData (DataFormats.FileDrop);
			if (filenames != null) {
				foreach (string fileName in filenames)
					_filesListBox.Items.Add ("Drop => " + fileName);
			}
		}
	}
开发者ID:mono,项目名称:gert,代码行数:10,代码来源:MainForm.cs

示例7: textBox_DragDrop

        private void textBox_DragDrop(object sender, DragEventArgs e)
        {
            // get file
            string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
            string file = files.FirstOrDefault();

            // set file
            TextBox textBox = sender as TextBox;
            textBox.Text = File.ReadAllText(file);
        }
开发者ID:jwbats,项目名称:WidgetGenerator,代码行数:10,代码来源:Form1.cs

示例8: MainForm_DragEnter

 private void MainForm_DragEnter(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent(DataFormats.FileDrop))
     {
         e.Effect = DragDropEffects.Copy;
     }
     else
     {
         e.Effect = DragDropEffects.None;
     }
 }
开发者ID:sinshu,项目名称:rss_uneune,代码行数:11,代码来源:MainForm.cs

示例9: GroupBox_DragEnter

	void GroupBox_DragEnter (object sender, DragEventArgs e)
	{
		if (e.Data.GetDataPresent (DataFormats.FileDrop)) {
			string [] filenames = (string []) e.Data.GetData (DataFormats.FileDrop);
			if (filenames != null) {
				e.Effect = DragDropEffects.Copy;
				foreach (string fileName in filenames)
					_filesListBox.Items.Add ("Enter => " + fileName);
			} else {
				e.Effect = DragDropEffects.None;
			}
		}
	}
开发者ID:mono,项目名称:gert,代码行数:13,代码来源:MainForm.cs

示例10: HandleDrag

    private void HandleDrag(object o, DragEventArgs e)
    {
        if(!CanRotate()) return;
        if(e.StartPosition == e.EndPosition)return;

        Vector3 applydir = lastdir *0.3f + e.Direction*inverseMulti;// * 0.7f;

        xrot = transform.localEulerAngles.y + applydir.x * e.Force *10f;

        yrot += applydir.y * e.Force*1.5f;
        yrot = Mathf.Clamp (yrot, -60, 60);

        wantToBeEuler = new Vector3(-yrot, xrot, 0);
        wantToBeRot = Quaternion.Euler(wantToBeEuler);
    }
开发者ID:soralapio,项目名称:turkubeforethegreatfire,代码行数:15,代码来源:PointerController.cs

示例11: OnDragOver

    protected override void OnDragOver(DragEventArgs e)
    {
        if (!this.AllowRowReorder)
        {
            e.Effect = DragDropEffects.None;
            return;
        }

        if (!e.Data.GetDataPresent(DataFormats.Text))
        {
            e.Effect = DragDropEffects.None;
            return;
        }

        Point cp = base.PointToClient(new Point(e.X, e.Y));
        ListViewItem hoverItem = base.GetItemAt(cp.X, cp.Y);
        if (hoverItem == null)
        {
            e.Effect = DragDropEffects.None;
            return;
        }

        foreach (ListViewItem moveItem in base.SelectedItems)
        {
            if (moveItem.Index == hoverItem.Index)
            {
                e.Effect = DragDropEffects.None;
                hoverItem.EnsureVisible();
                return;
            }
        }

        base.OnDragOver(e);

        String text = (String)e.Data.GetData(REORDER.GetType());
        if (text.CompareTo(REORDER) == 0)
        {
            e.Effect = DragDropEffects.Move;
            hoverItem.EnsureVisible();
        }
        else
        {
            e.Effect = DragDropEffects.None;
        }
    }
开发者ID:dogmahtagram,项目名称:Finale,代码行数:45,代码来源:DragDropListView.cs

示例12: AddCrossingInCell

    public bool AddCrossingInCell(DragEventArgs e)
    {
        GridCell OnGridCellDropped = determinePicboxLocation(simulation.gridPanel.PointToClient(new Point(e.X, e.Y)));
        if (OnGridCellDropped != null)
        {
            PictureBox picbox = CreatePicBox(OnGridCellDropped);

            Bitmap image = (Bitmap)e.Data.GetData(DataFormats.Bitmap);
            picbox.Image = image;
            picbox.SizeMode = PictureBoxSizeMode.StretchImage;
            simulation.gridPanel.Controls.Add(picbox);
            pictureBoxCrossing.Add(picbox);
            LinkCrossingAndGridCell(OnGridCellDropped, image);
            return true;
        }
        else
            return false;
    }
开发者ID:ProCP-Fontys,项目名称:Simulation,代码行数:18,代码来源:Simulator.cs

示例13: DetermineDragDropEffect

        private static DragDropEffects DetermineDragDropEffect(DragEventArgs e)
        {
            DragDropEffects effect_out;
            effect_out = effectPriorityList.SingleOrDefault((effect) => e.AllowedEffects == effect);
            bool multiEffect = effect_out == DragDropEffects.None;

            if (multiEffect)
            {
                // choose the first effect from priority if there are multiple allowedEffects
                effect_out = effectPriorityList.FirstOrDefault((effect) => (e.AllowedEffects & effect) != DragDropEffects.None);
                if ((e.KeyStates & DragDropKeyStates.ShiftKey) != DragDropKeyStates.None)
                    if ((e.KeyStates & DragDropKeyStates.ControlKey) != DragDropKeyStates.None)
                        effect_out = e.AllowedEffects & DragDropEffects.Link;
                    else
                        effect_out = e.AllowedEffects & DragDropEffects.Move;
            }

            return effect_out;
        }
开发者ID:jithuin,项目名称:infogeezer,代码行数:19,代码来源:DragDrop.cs

示例14: TreeView_DragDrop

	void TreeView_DragDrop (object sender, DragEventArgs e)
	{
		// Retrieve the client coordinates of the drop location.
		Point targetPoint = _treeView.PointToClient (new Point (e.X, e.Y));

		// Retrieve the node at the drop location
		TreeNode targetNode = _treeView.GetNodeAt (targetPoint);

		// Retrieve the node that was dragged.
		TreeNode draggedNode = (TreeNode) e.Data.GetData (typeof (TreeNode));

		// Confirm that the node at the drop location is not 
		// the dragged node or a descendant of the dragged node.
		if (draggedNode != targetNode && !ContainsNode (draggedNode, targetNode)) {
			// If it is a move operation, remove the node from its current 
			// location and add it to the node at the drop location.
			if (e.Effect == DragDropEffects.Move) {
				_eventsText.AppendText ("DragDrop (Move): " + draggedNode.Text
					+ " => " + targetNode.Text + Environment.NewLine);

				draggedNode.Remove ();
				targetNode.Nodes.Add (draggedNode);
			}

			// If it is a copy operation, clone the dragged node
			// and add it to the node at the drop location
			if (e.Effect == DragDropEffects.Copy) {
				_eventsText.AppendText ("DragDrop (Move): " + draggedNode.Text
					+ " => " + targetNode.Text + Environment.NewLine);

				targetNode.Nodes.Add ((TreeNode) draggedNode.Clone ());
			}

			// Expand the node at the location 
			// to show the dropped node.
			targetNode.Expand ();
		} else {
			_eventsText.AppendText ("DragDrop (Descendant): " + draggedNode.Text
				+ " => " + targetNode.Text + Environment.NewLine);
		}
	}
开发者ID:mono,项目名称:gert,代码行数:41,代码来源:MainForm.cs

示例15: DragDrop

 public void DragDrop(object sender, DragEventArgs e)
 {
     if (DragDropFlag)
     {
         e.Effects = DetermineDragDropEffect(e);
         IDataObject dataObject = e.Data;
         DataObjectBase dataWrapper = DataObjectBase.GetDataObjectWrapper(dataObject);
         TextBox uiTb = sender as TextBox;
         if (dataWrapper != null && uiTb != null)
         {
             debugText.Clear();
             debugText.Append(dataWrapper.DataString);
             e.Handled = true;
         }
         else
         {
             try
             {
                 debugText.Append(""
                     //*/
                     + "e.AllowedEffect: " + e.AllowedEffects.ToString() + "\r\n" +
                     "e.Data: " + e.Data.GetData(e.Data.GetFormats()[0]).ToString() + "\r\n" +
                     "e.Effect: " + e.Effects.ToString() + "\r\n" +
                     "e.KeyState: " + e.KeyStates.ToString() + "\r\n"
                     /*/
                      /*
                        + "e.AllowedEffect: " + e.AllowedEffect.ToString() + "\r\n" +
                        "e.Data: " + e.Data.GetData(e.Data.GetFormats()[0]).ToString() + "\r\n" +
                        "e.Effect: " + e.Effect.ToString() + "\r\n" +
                        "e.KeyState: " + e.KeyState.ToString() + "\r\n" +
                        "e.X: " + e.X.ToString() + "\r\n" +
                        "e.Y: " + e.Y.ToString() + "\r\n"
                     //*/
                 );
             }
             catch (Exception) { ;}
         }
     }
 }
开发者ID:jithuin,项目名称:infogeezer,代码行数:39,代码来源:DragDrop.cs


注:本文中的DragEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。