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


C# IDataObject.SetDropDescription方法代码示例

本文整理汇总了C#中IDataObject.SetDropDescription方法的典型用法代码示例。如果您正苦于以下问题:C# IDataObject.SetDropDescription方法的具体用法?C# IDataObject.SetDropDescription怎么用?C# IDataObject.SetDropDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDataObject的用法示例。


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

示例1: DragEnter

		/// <summary>
		/// Sets the drop description of the IDataObject and then notifies the
		/// DragDropHelper that the specified Control received a DragEnter event.
		/// </summary>
		/// <param name="control">The Control the received the DragEnter event.</param>
		/// <param name="data">The DataObject containing a drag image.</param>
		/// <param name="cursorOffset">The current cursor's offset relative to the window.</param>
		/// <param name="effect">The accepted drag drop effect.</param>
		/// <param name="descriptionMessage">The drop description message.</param>
		/// <param name="descriptionInsert">The drop description insert.</param>
		/// <remarks>
		/// Because the DragLeave event in SWF does not provide the IDataObject in the
		/// event args, this DragEnter override of the DropTargetHelper will cache a
		/// copy of the IDataObject based on the provided Control so that it may be
		/// cleared using the DragLeave override that takes a Control parameter. Note that
		/// if you use this override of DragEnter, you must call the DragLeave override
		/// that takes a Control parameter to avoid a possible memory leak. However, calling
		/// this method multiple times with the same Control parameter while not calling the
		/// DragLeave method will not leak memory.
		/// </remarks>
		public static void DragEnter(Control control, IDataObject data, Point cursorOffset, DragDropEffects effect,
		                             string descriptionMessage, string descriptionInsert) {
			data.SetDropDescription((DropImageType) effect, descriptionMessage, descriptionInsert);
			DragEnter(control, data, cursorOffset, effect);

			if (!s_dataContext.ContainsKey(control))
				s_dataContext.Add(control, data);
			else
				s_dataContext[control] = data;
		}
开发者ID:hbaes,项目名称:updateSystem.NET,代码行数:30,代码来源:SwfDropTargetHelper.cs

示例2: DefaultGiveFeedback

        /// <summary>
        /// Provides a default GiveFeedback event handler for drag sources.
        /// </summary>
        /// <param name="data">The associated data object for the event.</param>
        /// <param name="e">The event arguments.</param>
        public static void DefaultGiveFeedback(IDataObject data, GiveFeedbackEventArgs e)
        {
            // For drop targets that don't set the drop description, we'll
            // set a default one. Drop targets that do set drop descriptions
            // should set an invalid drop description during DragLeave.
            bool setDefaultDropDesc = false;
            bool isDefaultDropDesc = IsDropDescriptionDefault(data);
            DropImageType currentType = DropImageType.Invalid;
            if (!IsDropDescriptionValid(data) || isDefaultDropDesc)
            {
                currentType = GetDropImageType(data);
                setDefaultDropDesc = true;
            }

            if (IsShowingLayered(data))
            {
                // The default drag source implementation uses drop descriptions,
                // so we won't use default cursors.
                e.UseDefaultCursors = false;
                Cursor.Current = Cursors.Arrow;
            }
            else
                e.UseDefaultCursors = true;

            // We need to invalidate the drag image to refresh the drop description.
            // This is tricky to implement correctly, but we try to mimic the Windows
            // Explorer behavior. We internally use a flag to tell us to invalidate
            // the drag image, so if that is set, we'll invalidate. Otherwise, we
            // always invalidate if the drop description was set by the drop target,
            // *or* if the current drop image is not None. So if we set a default
            // drop description to anything but None, we'll always invalidate.
            if (InvalidateRequired(data) || !isDefaultDropDesc || currentType != DropImageType.None)
            {
                InvalidateDragImage(data);

                // The invalidate required flag only lasts for one invalidation
                SetInvalidateRequired(data, false);
            }

            // If the drop description is currently invalid, or if it is a default
            // drop description already, we should check about re-setting it.
            if (setDefaultDropDesc)
            {
                // Only change if the effect changed
                if ((DropImageType) e.Effect != currentType)
                {
                    if (e.Effect == DragDropEffects.Copy)
                        data.SetDropDescription(DropImageType.Copy, "Copy", "");
                    else if (e.Effect == DragDropEffects.Link)
                        data.SetDropDescription(DropImageType.Link, "Link", "");
                    else if (e.Effect == DragDropEffects.Move)
                        data.SetDropDescription(DropImageType.Move, "Move", "");
                    else if (e.Effect == DragDropEffects.None)
                        data.SetDropDescription(DropImageType.None, null, null);
                    SetDropDescriptionIsDefault(data, true);

                    // We can't invalidate now, because the drag image manager won't
                    // pick it up... so we set this flag to invalidate on the next
                    // GiveFeedback event.
                    SetInvalidateRequired(data, true);
                }
            }
        }
开发者ID:applejian,项目名称:cyberduck,代码行数:68,代码来源:DragDropLib.cs

示例3: DragLeave

 /// <summary>
 /// Notifies the DragDropHelper that the current Window received
 /// a DragLeave event.
 /// </summary>
 /// <param name="data">The data object associated to the event.</param>
 public static void DragLeave(IDataObject data)
 {
     data.SetDropDescription(DropImageType.Invalid, null, null);
     DragLeave();
 }
开发者ID:paulcbetts,项目名称:InstallQueuer,代码行数:10,代码来源:ShellDragDrop.cs

示例4: DragEnter

 /// <summary>
 /// Notifies the DragDropHelper that the specified Window received
 /// a DragEnter event.
 /// </summary>
 /// <param name="window">The Window the received the DragEnter event.</param>
 /// <param name="data">The DataObject containing a drag image.</param>
 /// <param name="cursorOffset">The current cursor's offset relative to the window.</param>
 /// <param name="effect">The accepted drag drop effect.</param>
 /// <param name="descriptionMessage">The drop description message.</param>
 /// <param name="descriptionInsert">The drop description insert.</param>
 /// <remarks>Callers of this DragEnter override should make sure to call
 /// the DragLeave override taking an IDataObject parameter in order to clear
 /// the drop description.</remarks>
 public static void DragEnter(Window window, IDataObject data, Point cursorOffset, DragDropEffects effect, string descriptionMessage, string descriptionInsert)
 {
     data.SetDropDescription((DropImageType)effect, descriptionMessage, descriptionInsert);
     DragEnter(window, data, cursorOffset, effect);
 }
开发者ID:paulcbetts,项目名称:InstallQueuer,代码行数:18,代码来源:ShellDragDrop.cs


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