예제 #1
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);
        }
예제 #2
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);
        }
예제 #3
0
        protected virtual object CreateDataObject(ObjectListView olv)
        {
            OLVDataObject obj2 = new OLVDataObject(olv);

            obj2.CreateTextFormats();
            return(obj2);
        }
예제 #4
0
        public virtual void EndDrag(object dragObject, DragDropEffects effect)
        {
            OLVDataObject obj2 = dragObject as OLVDataObject;

            if ((obj2 != null) && this.RefreshAfterDrop)
            {
                obj2.ListView.RefreshObjects(obj2.ModelObjects);
            }
        }
예제 #5
0
        /// <summary>
        /// The drag operation is finished. Refreshe the dragged rows if so configured.
        /// </summary>
        /// <param name="dragObject"></param>
        /// <param name="effect"></param>
        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);
            }
        }
        public override void Enter(DragEventArgs args)
        {
            this.originalFullRowSelect    = this.ListView.FullRowSelect;
            this.ListView.FullRowSelect   = false;
            this.dropEventArgs            = new ModelDropEventArgs();
            this.dropEventArgs.DropSink   = this;
            this.dropEventArgs.ListView   = this.ListView;
            this.dropEventArgs.DataObject = args.Data;
            OLVDataObject data = args.Data as OLVDataObject;

            if (data != null)
            {
                this.dropEventArgs.SourceListView = data.ListView;
                this.dropEventArgs.SourceModels   = data.ModelObjects;
            }
            this.Over(args);
        }
예제 #7
0
        /// <summary>
        /// Return a html representation of the given objects
        /// </summary>
        public virtual string ObjectsToHtml(IList objectsToConvert)
        {
            if (objectsToConvert.Count == 0)
                return String.Empty;

            OLVDataObject dataObject = new OLVDataObject(this, objectsToConvert);
            return dataObject.CreateHtml();
        }
예제 #8
0
        /// <summary>
        /// Copy a text and html representation of the given objects onto the clipboard.
        /// </summary>
        public virtual void CopyObjectsToClipboard(IList objectsToCopy)
        {
            if (objectsToCopy.Count == 0)
                return;

            // We don't know where these objects came from, so we can't use the DragSource to create
            // the data object, like we do with CopySelectionToClipboard() above.
            OLVDataObject dataObject = new OLVDataObject(this, objectsToCopy);
            dataObject.CreateTextFormats();
            Clipboard.SetDataObject(dataObject);
        }
예제 #9
0
파일: DragSource.cs 프로젝트: ylc03/FQMTool
 /// <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;
 }
예제 #10
0
 public override object StartDrag(ObjectListView olv, MouseButtons button, OLVListItem item)
 {
     DataObject t = _form.HostDrag(olv);
     OLVDataObject data = new OLVDataObject(olv);
     data.SetData(DataFormats.FileDrop, new[] {t.GetFileDropList()[0]});
     return data;
 }