婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > asp.net DoDragDrop 方法的使用

asp.net DoDragDrop 方法的使用

熱門標簽:銅川小型外呼系統運營商 海外地圖標注門市標 山西防封卡電銷卡套餐 上海楊浦怎么申請申請400電話 廈門商鋪地圖標注 浙江外呼系統怎么安裝 陜西人工外呼系統哪家好 云南外呼電銷機器人系統 地圖標注多個行程
在類庫中的定義為:
復制代碼 代碼如下:

[UIPermissionAttribute(SecurityAction.Demand, Clipboard = UIPermissionClipboard.OwnClipboard)]
public DragDropEffects DoDragDrop(
Object data,
DragDropEffects allowedEffects
)

其中data參數為要拖放的數據,如果拖動操作需要于另一個進程的應用程序相互操作,data代表的數據應該是基本托管類(String,BitMap,或MetaFile),或者是實現 ISerializable 或IDataObject的對象。 allowedEffects參數表示拖放的效果,為一個枚舉值(DragDropEffects).返回值也為DragDropEffects枚舉值。
  當開始調用DoDragDrop方法拖動一個數據對象時,DoDragDrops在拖放過程中,檢測當前光標位置下的控件是不是有效的放置目標。如果當前光標下的控件是有效的放置目標,則GiveFeedBack事件以指定的拖放效果引發。在檢測當前位置光標是否為有效的拖放目標時,DoDragDrops方法同時跟蹤光標位置,鍵盤狀態和鼠標狀態的更改。
   (1)如果用于移出了一個窗口,則引發DragLeave事件。
  (2)如果移入了另外一個控件,則引發該控件的DragEnter事件。
  (3)如果鼠標移動,但是停留在一個控件中,則引發DragOver事件。
如果檢測到更改了鍵盤或者鼠標狀態,則引發拖放源的QueryContinueDrag事件, 并根據事件的QueryContinueDragEventArgs的Action屬性值確定繼續拖動,放置數據或取消操作。
(1)如果Action屬性指定為Continue,則將引發DragOver事件。
(2)如果Action屬性指定為Drop,則將放置效果返回給源,以便應用程序對數據進行適當的操作;例如,如果是移動操作,則剪切數據。
(3)如果是DragAction的值為Cancel,則引發DragLeave事件
從csdn上摘抄一段示例代碼:
  下面的代碼示例演示在兩個 ListBox 控件之間的拖放操作。當拖動動作啟動時,該示例調用 DoDragDrop 方法。在 MouseDown 事件期間,如果從鼠標位置起鼠標移動的距離大于 SystemInformation..::.DragSize,則啟動拖動動作。IndexFromPoint 方法用于確定在 MouseDown 事件期間要拖動的項的索引。
  該示例還演示如何對拖放操作使用自定義光標。該示例要求應用程序目錄中存在兩個光標文件:3dwarro.cur 和 3dwno.cur,分別用于自定義拖動光標和禁止停放光標。如果選中 UseCustomCursorsCheckCheckBox,則使用自定義光標。自定義光標在 GiveFeedback 事件處理程序中設置。
  鍵盤狀態在右 ListBox 的 DragOver 事件處理程序中計算,以確定基于 Shift、Ctrl、Alt 或 Ctrl+Alt 鍵的狀態將發生哪種拖動操作。放置動作在 ListBox 中發生的位置也在 DragOver 事件期間確定。如果要放置的數據不是 String,則 DragDropEffects 中將把 DragEventArgs.sEffect 設置為 None。最后,停放狀態在 DropLocationLabelLabel 中顯示。
  要放置的用于右 ListBox 的數據在 DragDrop 事件處理程序中確定,并且在 ListBox 中的適當位置添加該 String 值。如果拖動操作移動到窗體邊框的外面,則 QueryContinueDrag 事件處理程序中將取消拖放操作
復制代碼 代碼如下:

using System;
using System.Drawing;
using System.Windows.Forms;
namespace Snip_DragNDrop
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.ListBox ListDragSource;
private System.Windows.Forms.ListBox ListDragTarget;
private System.Windows.Forms.CheckBox UseCustomCursorsCheck;
private System.Windows.Forms.Label DropLocationLabel;
private int indexOfItemUnderMouseToDrag;
private int indexOfItemUnderMouseToDrop;
private Rectangle dragBoxFromMouseDown;
private Point screenOffset;
private Cursor MyNoDropCursor;
private Cursor MyNormalCursor;
/// The main entry point for the application.
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
public Form1()
{
this.ListDragSource = new System.Windows.Forms.ListBox();
this.ListDragTarget = new System.Windows.Forms.ListBox();
this.UseCustomCursorsCheck = new System.Windows.Forms.CheckBox();
this.DropLocationLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
// ListDragSource
this.ListDragSource.Items.AddRange(new object[] {"one", "two", "three", "four",
"five", "six", "seven", "eight",
"nine", "ten"});
this.ListDragSource.Location = new System.Drawing.Point(10, 17);
this.ListDragSource.Size = new System.Drawing.Size(120, 225);
this.ListDragSource.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ListDragSource_MouseDown);
this.ListDragSource.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.ListDragSource_QueryContinueDrag);
this.ListDragSource.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ListDragSource_MouseUp);
this.ListDragSource.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ListDragSource_MouseMove);
this.ListDragSource.GiveFeedback += new System.Windows.Forms.GiveFeedbackEventHandler(this.ListDragSource_GiveFeedback);
// ListDragTarget
this.ListDragTarget.AllowDrop = true;
this.ListDragTarget.Location = new System.Drawing.Point(154, 17);
this.ListDragTarget.Size = new System.Drawing.Size(120, 225);
this.ListDragTarget.DragOver += new System.Windows.Forms.DragEventHandler(this.ListDragTarget_DragOver);
this.ListDragTarget.DragDrop += new System.Windows.Forms.DragEventHandler(this.ListDragTarget_DragDrop);
this.ListDragTarget.DragEnter += new System.Windows.Forms.DragEventHandler(this.ListDragTarget_DragEnter);
this.ListDragTarget.DragLeave += new System.EventHandler(this.ListDragTarget_DragLeave);
// UseCustomCursorsCheck
this.UseCustomCursorsCheck.Location = new System.Drawing.Point(10, 243);
this.UseCustomCursorsCheck.Size = new System.Drawing.Size(137, 24);
this.UseCustomCursorsCheck.Text = "Use Custom Cursors";
// DropLocationLabel
this.DropLocationLabel.Location = new System.Drawing.Point(154, 245);
this.DropLocationLabel.Size = new System.Drawing.Size(137, 24);
this.DropLocationLabel.Text = "None";
// Form1
this.ClientSize = new System.Drawing.Size(292, 270);
this.Controls.AddRange(new System.Windows.Forms.Control[] {this.ListDragSource,
this.ListDragTarget, this.UseCustomCursorsCheck,
this.DropLocationLabel});
this.Text = "drag-and-drop Example";
this.ResumeLayout(false);
}
private void ListDragSource_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
// Get the index of the item the mouse is below.
indexOfItemUnderMouseToDrag = ListDragSource.IndexFromPoint(e.X, e.Y);
if (indexOfItemUnderMouseToDrag != ListBox.NoMatches) {
// Remember the point where the mouse down occurred. The DragSize indicates
// the size that the mouse can move before a drag event should be started.
Size dragSize = SystemInformation.DragSize;
// Create a rectangle using the DragSize, with the mouse position being
// at the center of the rectangle.
dragBoxFromMouseDown = new Rectangle(new Point(e.X - (dragSize.Width /2),
e.Y - (dragSize.Height /2)), dragSize);
} else
// Reset the rectangle if the mouse is not over an item in the ListBox.
dragBoxFromMouseDown = Rectangle.Empty;
}
private void ListDragSource_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) {
// Reset the drag rectangle when the mouse button is raised.
dragBoxFromMouseDown = Rectangle.Empty;
}
private void ListDragSource_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if ((e.Button MouseButtons.Left) == MouseButtons.Left) {
// If the mouse moves outside the rectangle, start the drag.
if (dragBoxFromMouseDown != Rectangle.Empty
!dragBoxFromMouseDown.Contains(e.X, e.Y)) {
// Create custom cursors for the drag-and-drop operation.
try {
MyNormalCursor = new Cursor("3dwarro.cur");
MyNoDropCursor = new Cursor("3dwno.cur");
} catch {
// An error occurred while attempting to load the cursors, so use
// standard cursors.
UseCustomCursorsCheck.Checked = false;
}finally {
// The screenOffset is used to account for any desktop bands
// that may be at the top or left side of the screen when
// determining when to cancel the drag drop operation.
screenOffset = SystemInformation.WorkingArea.Location;
// Proceed with the drag-and-drop, passing in the list item.
DragDropEffects dropEffect = ListDragSource.DoDragDrop(ListDragSource.Items[indexOfItemUnderMouseToDrag], DragDropEffects.All | DragDropEffects.Link);
// If the drag operation was a move then remove the item.
if (dropEffect == DragDropEffects.Move) {
ListDragSource.Items.RemoveAt(indexOfItemUnderMouseToDrag);
// Selects the previous item in the list as long as the list has an item.
if (indexOfItemUnderMouseToDrag > 0)
ListDragSource.SelectedIndex = indexOfItemUnderMouseToDrag -1;
else if (ListDragSource.Items.Count > 0)
// Selects the first item.
ListDragSource.SelectedIndex =0;
}
// Dispose of the cursors since they are no longer needed.
if (MyNormalCursor != null)
MyNormalCursor.Dispose();
if (MyNoDropCursor != null)
MyNoDropCursor.Dispose();
}
}
}
}
private void ListDragSource_GiveFeedback(object sender, System.Windows.Forms.GiveFeedbackEventArgs e)
{
// Use custom cursors if the check box is checked.
if (UseCustomCursorsCheck.Checked) {
// Sets the custom cursor based upon the effect.
e.UseDefaultCursors = false;
if ((e.Effect DragDropEffects.Move) == DragDropEffects.Move)
Cursor.Current = MyNormalCursor;
else
Cursor.Current = MyNoDropCursor;
}
}
private void ListDragTarget_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
{
// Determine whether string data exists in the drop data. If not, then
// the drop effect reflects that the drop cannot occur.
if (!e.Data.GetDataPresent(typeof(System.String))) {
e.Effect = DragDropEffects.None;
DropLocationLabel.Text = "None - no string data.";
return;
}
// Set the effect based upon the KeyState.
if ((e.KeyState (8+32)) == (8+32)
(e.AllowedEffect DragDropEffects.Link) == DragDropEffects.Link) {
// KeyState 8 + 32 = CTL + ALT
// Link drag-and-drop effect.
e.Effect = DragDropEffects.Link;
} else if ((e.KeyState 32) == 32
(e.AllowedEffect DragDropEffects.Link) == DragDropEffects.Link) {
// ALT KeyState for link.
e.Effect = DragDropEffects.Link;
} else if ((e.KeyState 4) == 4
(e.AllowedEffect DragDropEffects.Move) == DragDropEffects.Move) {
// SHIFT KeyState for move.
e.Effect = DragDropEffects.Move;
} else if ((e.KeyState 8) == 8
(e.AllowedEffect DragDropEffects.Copy) == DragDropEffects.Copy) {
// CTL KeyState for copy.
e.Effect = DragDropEffects.Copy;
} else if ((e.AllowedEffect DragDropEffects.Move) == DragDropEffects.Move) {
// By default, the drop action should be move, if allowed.
e.Effect = DragDropEffects.Move;
} else
e.Effect = DragDropEffects.None;
// Get the index of the item the mouse is below.
// The mouse locations are relative to the screen, so they must be
// converted to client coordinates.
indexOfItemUnderMouseToDrop =
ListDragTarget.IndexFromPoint(ListDragTarget.PointToClient(new Point(e.X, e.Y)));
// Updates the label text.
if (indexOfItemUnderMouseToDrop != ListBox.NoMatches){
DropLocationLabel.Text = "Drops before item #" + (indexOfItemUnderMouseToDrop + 1);
} else
DropLocationLabel.Text = "Drops at the end.";
}
private void ListDragTarget_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
// Ensure that the list item index is contained in the data.
if (e.Data.GetDataPresent(typeof(System.String))) {
Object item = (object)e.Data.GetData(typeof(System.String));
// Perform drag-and-drop, depending upon the effect.
if (e.Effect == DragDropEffects.Copy ||
e.Effect == DragDropEffects.Move) {
// Insert the item.
if (indexOfItemUnderMouseToDrop != ListBox.NoMatches)
ListDragTarget.Items.Insert(indexOfItemUnderMouseToDrop, item);
else
ListDragTarget.Items.Add(item);
}
}
// Reset the label text.
DropLocationLabel.Text = "None";
}
private void ListDragSource_QueryContinueDrag(object sender, System.Windows.Forms.QueryContinueDragEventArgs e) {
// Cancel the drag if the mouse moves off the form.
ListBox lb = sender as ListBox;
if (lb != null) {
Form f = lb.FindForm();
// Cancel the drag if the mouse moves off the form. The screenOffset
// takes into account any desktop bands that may be at the top or left
// side of the screen.
if (((Control.MousePosition.X - screenOffset.X) f.DesktopBounds.Left) ||
((Control.MousePosition.X - screenOffset.X) > f.DesktopBounds.Right) ||
((Control.MousePosition.Y - screenOffset.Y) f.DesktopBounds.Top) ||
((Control.MousePosition.Y - screenOffset.Y) > f.DesktopBounds.Bottom)) {
e.Action = DragAction.Cancel;
}
}
}
private void ListDragTarget_DragEnter(object sender, System.Windows.Forms.DragEventArgs e) {
// Reset the label text.
DropLocationLabel.Text = "None";
}
private void ListDragTarget_DragLeave(object sender, System.EventArgs e) {
// Reset the label text.
DropLocationLabel.Text = "None";
}
}
}

對用這種拖放操作和微軟的服務,容器模式的關系,留在以后再學習。

標簽:許昌 信陽 朔州 西雙版納 孝感 自貢 常州 萊蕪

巨人網絡通訊聲明:本文標題《asp.net DoDragDrop 方法的使用》,本文關鍵詞  asp.net,DoDragDrop,方法,的,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《asp.net DoDragDrop 方法的使用》相關的同類信息!
  • 本頁收集關于asp.net DoDragDrop 方法的使用的相關信息資訊供網民參考!
  • 推薦文章
    婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av
    日韩精品一二三四| 国产91富婆露脸刺激对白| 色老汉一区二区三区| 亚洲丰满少妇videoshd| 日韩欧美一区在线| eeuss鲁片一区二区三区| 亚洲一区av在线| 另类小说一区二区三区| 国产精品亚洲综合一区在线观看| 国产欧美日韩激情| 欧美在线观看视频在线| 国内精品视频一区二区三区八戒 | 久久久高清一区二区三区| 99久久精品免费看国产免费软件| 亚洲图片欧美色图| 久久久久久影视| 欧美精品18+| 91网站最新地址| 国产毛片精品国产一区二区三区| 亚洲国产精品久久艾草纯爱| 久久人人97超碰com| 欧美日韩国产成人在线91| 成人黄页毛片网站| 国产一区二区三区蝌蚪| 奇米影视一区二区三区小说| 国产精品久久久久天堂| 欧美sm美女调教| 欧美三级电影一区| 色老头久久综合| 国产伦精品一区二区三区免费迷| 国产激情精品久久久第一区二区 | 欧美精品vⅰdeose4hd| 国产成人aaa| 九九热在线视频观看这里只有精品| 一区二区三区视频在线看| 国产精品欧美一区喷水| 337p日本欧洲亚洲大胆色噜噜| 欧美色男人天堂| 欧美色倩网站大全免费| 欧美午夜精品一区二区三区| 91丨porny丨国产入口| 成人黄色软件下载| 日韩精品一区二区在线| 国产成人精品免费| 麻豆精品久久久| 爽好多水快深点欧美视频| 一区二区三区日韩| 亚洲一区精品在线| 一级精品视频在线观看宜春院| 亚洲欧美一区二区不卡| 亚洲日本中文字幕区| 亚洲男人电影天堂| 亚洲一区二区不卡免费| 亚洲一区免费观看| 美女看a上一区| 日本不卡在线视频| 奇米888四色在线精品| 麻豆精品国产传媒mv男同| 久久国产精品露脸对白| 精品在线一区二区三区| 国产成人一区二区精品非洲| 夫妻av一区二区| 91小视频在线免费看| 99麻豆久久久国产精品免费优播| 色婷婷精品久久二区二区蜜臂av| 色乱码一区二区三区88| 欧美挠脚心视频网站| 日韩精品一区二区三区视频在线观看 | 国产久卡久卡久卡久卡视频精品| 精品系列免费在线观看| 国产成人精品亚洲午夜麻豆| youjizz久久| 欧美精品一二三区| 国产日韩欧美精品在线| 美女被吸乳得到大胸91| 自拍偷拍国产精品| 视频在线观看91| 九九在线精品视频| 99久久99久久精品国产片果冻| 色婷婷久久一区二区三区麻豆| 欧美另类变人与禽xxxxx| 日韩视频中午一区| 国产精品国产a| 日本成人在线不卡视频| www.欧美精品一二区| 这里是久久伊人| 自拍偷拍国产精品| 国产在线视视频有精品| 在线观看国产91| 国产欧美精品一区| 免费观看一级欧美片| 99国产精品视频免费观看| 欧美大片一区二区三区| 中文字幕精品三区| 日韩精品91亚洲二区在线观看| 国产一区999| 欧美一区二区三区四区在线观看 | 久久久av毛片精品| 亚洲国产欧美日韩另类综合| 国产成人在线观看| 日韩视频在线一区二区| 亚洲精品视频在线看| 国产传媒日韩欧美成人| 欧美美女bb生活片| 亚洲欧美日韩国产综合在线| 国产一区二区网址| 欧美精品一二三| 亚洲自拍偷拍av| 色综合激情久久| 日韩毛片精品高清免费| 国产91精品精华液一区二区三区| 91精品国产综合久久久久久久久久| 亚洲人成伊人成综合网小说| 高清不卡一区二区在线| 欧美日韩一区高清| 国产精品色一区二区三区| 精品成人私密视频| 久久精品国产精品青草| 成人小视频在线观看| 国产精品久久久久一区| 精品粉嫩超白一线天av| 91麻豆精品国产91久久久资源速度 | 国产成人啪免费观看软件| 久久精品免费在线观看| 9191久久久久久久久久久| 91官网在线观看| 在线观看日韩电影| 久久99久国产精品黄毛片色诱| 成人一区二区三区| 不卡影院免费观看| 日本最新不卡在线| 亚洲女女做受ⅹxx高潮| 丝袜美腿一区二区三区| 欧美亚洲综合网| 精品99999| 亚洲电影一级黄| 欧美蜜桃一区二区三区| 亚洲视频在线观看一区| 91一区在线观看| 麻豆免费精品视频| 亚洲精品va在线观看| 久久久久久久网| 不卡一区二区在线| 国产清纯美女被跳蛋高潮一区二区久久w| 一区二区三区国产豹纹内裤在线| 欧美唯美清纯偷拍| 日韩高清国产一区在线| 国产成人一级电影| 欧洲日韩一区二区三区| 偷拍亚洲欧洲综合| www久久久久| 91理论电影在线观看| 三级影片在线观看欧美日韩一区二区| 欧美性受极品xxxx喷水| 三级一区在线视频先锋| 国产欧美一区二区在线| 欧美亚洲一区二区三区四区| 久久成人羞羞网站| 亚洲人吸女人奶水| 欧美丰满美乳xxx高潮www| 国产凹凸在线观看一区二区| 尤物视频一区二区| 国产精品欧美极品| 国产午夜久久久久| 日韩欧美一区二区视频| 制服丝袜av成人在线看| 欧美日免费三级在线| 一本色道亚洲精品aⅴ| 精品无人区卡一卡二卡三乱码免费卡| 中文字幕一区二区三区不卡在线 | 99久久精品免费| 天堂成人国产精品一区| 日韩亚洲欧美成人一区| 91在线播放网址| 精品亚洲国产成人av制服丝袜 | 天堂一区二区在线| 亚洲国产日韩精品| 欧美日韩高清一区二区| 亚洲va中文字幕| 日韩美一区二区三区| 欧美日韩一区二区在线观看 | 蜜桃精品视频在线观看| 丝袜美腿亚洲一区二区图片| 亚欧色一区w666天堂| 亚洲综合丝袜美腿| 亚洲高清视频在线| 日本亚洲天堂网| 加勒比av一区二区| 成人av资源下载| 91成人看片片| 91.麻豆视频| 国产亚洲精品超碰| 国产精品电影一区二区三区| 一区二区三区中文免费| 丝袜亚洲另类欧美综合| 久久丁香综合五月国产三级网站| 国产一区 二区| 在线视频你懂得一区| 91精品国产综合久久久久久 | 日本一二三不卡|