• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# DragEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: DragDockPanel_DragStarted

        /// <summary>
        /// Keeps a reference to the dragging panel.
        /// </summary>
        /// <param name="sender">The dragging panel.</param>
        /// <param name="args">Drag event args.</param>
        private void DragDockPanel_DragStarted(object sender, DragEventArgs args)
        {
            DragDockPanel panel = sender as DragDockPanel;

            // Keep reference to dragging panel
            this.draggingPanel = panel;
        }
开发者ID:TheMikina,项目名称:Blacklight-Toolkit,代码行数:12,代码来源:DragDockPanelHost.cs


示例17: DragDockPanel_DragMoved

        /// <summary>
        /// Shuffles the panels around.
        /// </summary>
        /// <param name="sender">The dragging panel.</param>
        /// <param name="args">Drag event args.</param>
        private void DragDockPanel_DragMoved(object sender, DragEventArgs args)
        {
            Point mousePosInHost =
                args.MouseEventArgs.GetPosition(this);

            int currentRow =
                (int)Math.Floor(mousePosInHost.Y /
                (this.ActualHeight / (double)this.rows));

            int currentColumn =
                (int)Math.Floor(mousePosInHost.X /
                (this.ActualWidth / (double)this.columns));

            // Stores the panel we will swap with
            DragDockPanel swapPanel = null;

            // Loop through children to see if there is a panel to swap with
            foreach (UIElement child in this.panels)
            {
                DragDockPanel panel = child as DragDockPanel;

                // If the panel is not the dragging panel and is in the current row
                // or current column... mark it as the panel to swap with
                if (panel != this.draggingPanel &&
                    Grid.GetColumn(panel) == currentColumn &&
                    Grid.GetRow(panel) == currentRow)
                {
                    swapPanel = panel;
                    break;
                }
            }

            // If there is a panel to swap with
            if (swapPanel != null)
            {
                // Store the new row and column
                int draggingPanelNewColumn = Grid.GetColumn(swapPanel);
                int draggingPanelNewRow = Grid.GetRow(swapPanel);

                // Update the swapping panel row and column
                Grid.SetColumn(swapPanel, Grid.GetColumn(this.draggingPanel));
                Grid.SetRow(swapPanel, Grid.GetRow(this.draggingPanel));

                // Update the dragging panel row and column
                Grid.SetColumn(this.draggingPanel, draggingPanelNewColumn);
                Grid.SetRow(this.draggingPanel, draggingPanelNewRow);

                // Animate the layout to the new positions
                this.AnimatePanelLayout();
            }
        }
开发者ID:TheMikina,项目名称:Blacklight-Toolkit,代码行数:56,代码来源:DragDockPanelHost.cs


示例18: DragDockPanel_DragFinished

        /// <summary>
        /// Drops the dragging panel.
        /// </summary>
        /// <param name="sender">The dragging panel.</param>
        /// <param name="args">Drag event args.</param>
        private void DragDockPanel_DragFinished(object sender, DragEventArgs args)
        {
            // Set dragging panel back to null
            this.draggingPanel = null;

            // Update the layout (to reset all panel positions)
            this.UpdatePanelLayout();
        }
开发者ID:TheMikina,项目名称:Blacklight-Toolkit,代码行数:13,代码来源:DragDockPanelHost.cs


示例19: FSE_Drop

        private void FSE_Drop(object sender, DragEventArgs e)
        {
            ButtonExt btn = sender as ButtonExt;

            string[] fileData = (string[])e.Data.GetData(DataFormats.FileDrop);

            if (fileData.Length > 0)
            {
                object temp = btn.Content;
                btn.Content = fileData[0];

                if (Source.Content.ToString() != source && Target.Content.ToString() != target)
                {
                    if (FSOpt.IsDirectory(Source.Content.ToString()) != FSOpt.IsDirectory(Target.Content.ToString()))
                    {
                        // warning
                        MessageBox msg = new MessageBox(this.Owner as MainWindow, "The type of the file entries are different!");
                        msg.Owner = this.Owner;
                        msg.ShowDialog();

                        btn.Content = temp;
                    }
                }
            }
        }
开发者ID:AndyAn,项目名称:Miiror,代码行数:25,代码来源:EditPanel.xaml.cs


示例20: FSE_DragEnter

 private void FSE_DragEnter(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent(DataFormats.FileDrop))
     {
         e.Effects = DragDropEffects.All;
     }
     else
     {
         e.Effects = DragDropEffects.None;
     }
 }
开发者ID:AndyAn,项目名称:Miiror,代码行数:11,代码来源:EditPanel.xaml.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DragEventHandler类代码示例发布时间:2022-05-24
下一篇:
C# DragDropInfo类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap