Пример #1
0
        protected virtual void OnPreviewDragHint(PreviewDragHintEventArgs e)
        {
            EventHandler <PreviewDragHintEventArgs> eh = this.Events[PreviewDragHintEventKey] as EventHandler <PreviewDragHintEventArgs>;

            if (eh != null)
            {
                eh(this, e);
            }
        }
Пример #2
0
        protected virtual void OnPreviewDragHint(PreviewDragHintEventArgs e)
        {
            EventHandler <PreviewDragHintEventArgs> eventHandler = this.Events[RadDragDropService.PreviewDragHintEventKey] as EventHandler <PreviewDragHintEventArgs>;

            if (eventHandler == null)
            {
                return;
            }
            eventHandler((object)this, e);
        }
Пример #3
0
        protected virtual bool PrepareContext()
        {
            //remember the cursor so that we may restore it when service is stopped.
            this.originalMouseCursor = Cursor.Current;

            RadItem contextElement = this.Context as RadItem;

            if (!contextElement.Capture)
            {
                contextElement.Capture = true;
            }

            //prepare the hint window
            ISupportDrag             dragObject = this.Context as ISupportDrag;
            PreviewDragHintEventArgs args       = new PreviewDragHintEventArgs(dragObject);

            this.OnPreviewDragHint(args);

            if (args.DragHint == null && args.UseDefaultHint)
            {
                args.DragHint = dragObject.GetDragHint();
            }

            this.hintWindow.BackgroundImage = args.DragHint;

            Size offsetSize;

            if (args.DragHint == null)
            {
                offsetSize = contextElement == null ? Size.Empty : contextElement.Size;
            }
            else
            {
                offsetSize = args.DragHint.Size;
            }

            this.xOutlineFormOffset = offsetSize.Width / 2;
            this.yOutlineFormOffset = offsetSize.Height / 2;
            return(true);
        }
Пример #4
0
        protected virtual bool PrepareContext()
        {
            this.originalMouseCursor = Cursor.Current;
            RadItem context1 = this.Context as RadItem;

            if (!context1.Capture)
            {
                context1.Capture = true;
            }
            ISupportDrag             context2 = this.Context as ISupportDrag;
            PreviewDragHintEventArgs e        = new PreviewDragHintEventArgs(context2);

            this.OnPreviewDragHint(e);
            if (e.DragHint == null && e.UseDefaultHint)
            {
                e.DragHint = context2.GetDragHint();
            }
            this.hintWindow.BackgroundImage = e.DragHint;
            Size size = e.DragHint != null ? e.DragHint.Size : (context1 == null ? Size.Empty : context1.Size);

            this.xOutlineFormOffset = size.Width / 2;
            this.yOutlineFormOffset = size.Height / 2;
            return(true);
        }