Esempio n. 1
0
 /// <summary>
 /// Sets a drop description flag.
 /// </summary>
 /// <param name="dataObject">The associated DataObject.</param>
 /// <param name="flag">The drop description flag to set.</param>
 /// <param name="enabled">True to set the flag, False to unset it.</param>
 private static void SetDropDescriptionFlag(IComDataObject dataObject, DropDescriptionFlags flag, bool enabled)
 {
     var current = GetDropDescriptionFlag(dataObject);
     var next = enabled ? (current | flag) : (current | flag) ^ flag;
     if (current != next)
     {
         dataObject.SetData("DropDescriptionFlags", (int)next);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Sets a drop description flag.
        /// </summary>
        /// <param name="dataObject">The associated DataObject.</param>
        /// <param name="flag">The drop description flag to set.</param>
        /// <param name="enabled">True to set the flag, False to unset it.</param>
        private static void SetDropDescriptionFlag(IComDataObject dataObject, DropDescriptionFlags flag, bool enabled)
        {
            var current = GetDropDescriptionFlag(dataObject);
            var next    = enabled ? (current | flag) : (current | flag) ^ flag;

            if (current != next)
            {
                dataObject.SetData("DropDescriptionFlags", (int)next);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Sets a drop description.
        /// </summary>
        public static void SetDropDescription(IComDataObject data, DropImageType dragDropEffects, string format, string insert)
        {
            if (format != null && format.Length > 259)
            {
                throw new ArgumentException("Format string exceeds the maximum allowed length of 259.", "format");
            }
            if (insert != null && insert.Length > 259)
            {
                throw new ArgumentException("Insert string exceeds the maximum allowed length of 259.", "insert");
            }

            // Fill the structure
            DropDescription dd;

            dd.type      = dragDropEffects;
            dd.szMessage = format;
            dd.szInsert  = insert;

            data.SetData("DropDescription", dd);
        }
Esempio n. 4
0
        /// <summary>
        /// Sets a drop description.
        /// </summary>
        public static void SetDropDescription(IComDataObject data, DropImageType dragDropEffects, string format, string insert)
        {
            if (format != null && format.Length > 259)
                throw new ArgumentException("Format string exceeds the maximum allowed length of 259.", "format");
            if (insert != null && insert.Length > 259)
                throw new ArgumentException("Insert string exceeds the maximum allowed length of 259.", "insert");

            // Fill the structure
            DropDescription dd;
            dd.type = dragDropEffects;
            dd.szMessage = format;
            dd.szInsert = insert;

            data.SetData("DropDescription", dd);
        }