/// <summary>
        /// Gets the current DropDescription's drop image type.
        /// </summary>
        /// <param name="dataObject">The DataObject.</param>
        /// <returns>The current drop image type.</returns>
        private static DropImageType GetDropImageType(IDataObject dataObject)
        {
            object data = ComDataObjectExtensions.GetDropDescription((System.Runtime.InteropServices.ComTypes.IDataObject)dataObject);

            if (data is DropDescription)
            {
                return((DropImageType)((DropDescription)data).type);
            }
            return(DropImageType.Invalid);
        }
Пример #2
0
        /// <summary>
        /// Checks if the current drop description, if any, is valid.
        /// </summary>
        /// <param name="dataObject">The DataObject from which to get the drop description.</param>
        /// <returns>True if the drop description is set, and the
        /// DropImageType is not DropImageType.Invalid.</returns>
        private static bool IsDropDescriptionValid(IDataObject dataObject)
        {
            object data = ComDataObjectExtensions.GetDropDescription((Runtime.InteropServices.ComTypes.IDataObject)dataObject);

            if (data is DropDescription)
            {
                return((DropImageType)((DropDescription)data).type != DropImageType.Invalid);
            }
            return(false);
        }
            /// <summary>
            /// Handles DataChanged events from a COM IDataObject.
            /// </summary>
            /// <param name="format">The data format that had a change.</param>
            /// <param name="stgmedium">The data value.</param>
            public void OnDataChange(ref FORMATETC format, ref STGMEDIUM stgmedium)
            {
                // We listen to DropDescription changes, so that we can unset the IsDefault
                // drop description flag.
                object odd = ComDataObjectExtensions.GetDropDescription((System.Runtime.InteropServices.ComTypes.IDataObject)data);

                if (odd != null)
                {
                    SetDropDescriptionIsDefault(data, false);
                }
            }