Пример #1
0
        private void DoImmediateDrag(Point mousePos)
        {
            PageViewLayoutInfo itemLayoutInfo = this.owner.ItemLayoutInfo;

            if (itemLayoutInfo == null)
            {
                return;
            }
            Point           client  = this.owner.ElementTree.Control.PointToClient(mousePos);
            RadPageViewItem hitItem = this.owner.ItemFromPoint(client);

            if (hitItem == null || hitItem == this.dragItem)
            {
                return;
            }
            RectangleF boundingRectangle1 = (RectangleF)this.dragItem.ControlBoundingRectangle;
            RectangleF boundingRectangle2 = (RectangleF)hitItem.ControlBoundingRectangle;

            if (!(!itemLayoutInfo.vertical ? ((double)boundingRectangle2.X <= (double)boundingRectangle1.X ? (double)client.X <(double)boundingRectangle2.X + (double)boundingRectangle1.Width : (double)client.X> (double) boundingRectangle2.Right - (double)boundingRectangle1.Width) : ((double)boundingRectangle2.Y <= (double)boundingRectangle1.Y ? (double)client.Y <(double)boundingRectangle2.Y + (double)boundingRectangle1.Height : (double)client.Y> (double) boundingRectangle2.Bottom - (double)boundingRectangle1.Height)))
            {
                return;
            }
            this.owner.PerformItemDrop(this.dragItem, hitItem);
            this.owner.UpdateLayout();
        }
Пример #2
0
        private void DoImmediateDrag(Point mousePos)
        {
            PageViewLayoutInfo layoutInfo = this.owner.ItemLayoutInfo;

            if (layoutInfo == null)
            {
                return;
            }

            Point           client  = this.owner.ElementTree.Control.PointToClient(mousePos);
            RadPageViewItem hitItem = this.owner.ItemFromPoint(client);

            if (hitItem == null || hitItem == this.dragItem)
            {
                return;
            }

            RectangleF dragBounds = this.dragItem.ControlBoundingRectangle;
            RectangleF hitBounds  = hitItem.ControlBoundingRectangle;
            bool       swapItems;

            if (layoutInfo.vertical)
            {
                if (hitBounds.Y > dragBounds.Y)
                {
                    swapItems = client.Y > hitBounds.Bottom - dragBounds.Height;
                }
                else
                {
                    swapItems = client.Y < hitBounds.Y + dragBounds.Height;
                }
            }
            else
            {
                if (hitBounds.X > dragBounds.X)
                {
                    swapItems = client.X > hitBounds.Right - dragBounds.Width;
                }
                else
                {
                    swapItems = client.X < hitBounds.X + dragBounds.Width;
                }
            }

            if (swapItems)
            {
                this.owner.PerformItemDrop(dragItem, hitItem);
                this.owner.UpdateLayout();
            }
        }
Пример #3
0
        private void PrepareInsertHint()
        {
            if (this.insertHintImage == null || this.insertHintImage.Image == null)
            {
                return;
            }

            PageViewLayoutInfo info           = this.owner.ItemLayoutInfo;
            RectangleF         itemsRectangle = this.owner.GetItemsRect();
            int length = info.vertical ? (int)itemsRectangle.Size.Width : (int)itemsRectangle.Size.Height;

            if (length <= 0)
            {
                return;
            }

            Size imageSize = this.insertHintImage.Image.Size;
            Size hintSize;

            if (info.vertical)
            {
                hintSize = new Size(length + this.insertHintImage.Margins.Horizontal, imageSize.Height);
            }
            else
            {
                hintSize = new Size(imageSize.Width, length + this.insertHintImage.Margins.Vertical);
            }

            //generate hint image
            Bitmap   image = new Bitmap(hintSize.Width, hintSize.Height);
            Graphics temp  = Graphics.FromImage(image);

            this.insertHintImage.Paint(temp, new RectangleF(PointF.Empty, hintSize));
            temp.Dispose();

            this.insertHint = new RadLayeredWindow();
            this.insertHint.BackgroundImage = image;
        }
Пример #4
0
        private void PrepareInsertHint()
        {
            if (this.insertHintImage == null || this.insertHintImage.Image == null)
            {
                return;
            }
            PageViewLayoutInfo itemLayoutInfo = this.owner.ItemLayoutInfo;
            RectangleF         itemsRect      = this.owner.GetItemsRect();
            int num = itemLayoutInfo.vertical ? (int)itemsRect.Size.Width : (int)itemsRect.Size.Height;

            if (num <= 0)
            {
                return;
            }
            Size     size1  = this.insertHintImage.Image.Size;
            Size     size2  = !itemLayoutInfo.vertical ? new Size(size1.Width, num + this.insertHintImage.Margins.Vertical) : new Size(num + this.insertHintImage.Margins.Horizontal, size1.Height);
            Bitmap   bitmap = new Bitmap(size2.Width, size2.Height);
            Graphics g      = Graphics.FromImage((Image)bitmap);

            this.insertHintImage.Paint(g, new RectangleF(PointF.Empty, (SizeF)size2));
            g.Dispose();
            this.insertHint = new RadLayeredWindow();
            this.insertHint.BackgroundImage = (Image)bitmap;
        }