Example #1
0
        /// <summary>
        /// Create a data object that will be used to as the data object
        /// for the drag operation.
        /// </summary>
        /// <remarks>
        /// Subclasses can override this method add new formats to the data object.
        /// </remarks>
        /// <param name="olv">The ObjectListView that is the source of the drag</param>
        /// <returns>A data object for the drag</returns>
        protected virtual object CreateDataObject(ObjectListView olv)
        {
            OLVDataObject data = new OLVDataObject(olv);

            data.CreateTextFormats();
            return(data);
        }
Example #2
0
        /// <summary>
        /// A drag has entered this control.
        /// </summary>
        /// <remarks>Implementators should set args.Effect to the appropriate DragDropEffects.</remarks>
        /// <param name="args"></param>
        public override void Enter(DragEventArgs args)
        {
            //System.Diagnostics.Debug.WriteLine("Enter");

            /*
             * When FullRowSelect is true, we have two problems:
             * 1) GetItemRect(ItemOnly) returns the whole row rather than just the icon/text, which messes
             *    up our calculation of the drop rectangle.
             * 2) during the drag, the Timer events will not fire! This is the major problem, since without
             *    those events we can't autoscroll.
             *
             * The first problem we can solve through coding, but the second is more difficult.
             * We avoid both problems by turning off FullRowSelect during the drop operation.
             */
            this.originalFullRowSelect  = this.ListView.FullRowSelect;
            this.ListView.FullRowSelect = false;

            // Setup our drop event args block
            this.dropEventArgs            = new ModelDropEventArgs();
            this.dropEventArgs.DropSink   = this;
            this.dropEventArgs.ListView   = this.ListView;
            this.dropEventArgs.DataObject = args.Data;
            OLVDataObject olvData = args.Data as OLVDataObject;

            if (olvData != null)
            {
                this.dropEventArgs.SourceListView = olvData.ListView;
                this.dropEventArgs.SourceModels   = olvData.ModelObjects;
            }

            this.Over(args);
        }
Example #3
0
        public virtual void EndDrag(Object dragObject, DragDropEffects effect)
        {
            OLVDataObject data = dragObject as OLVDataObject;

            if (data == null)
            {
                return;
            }

            if (this.RefreshAfterDrop)
            {
                data.ListView.RefreshObjects(data.ModelObjects);
            }
        }
 /// <summary>
 /// Create a data object that will be used to as the data object
 /// for the drag operation.
 /// </summary>
 /// <remarks>
 /// Subclasses can override this method add new formats to the data object.
 /// </remarks>
 /// <param name="olv">The ObjectListView that is the source of the drag</param>
 /// <returns>A data object for the drag</returns>
 protected virtual object CreateDataObject(ObjectListView olv) {
     OLVDataObject data = new OLVDataObject(olv);
     data.CreateTextFormats();
     return data;
 }