Exemplo n.º 1
0
 protected override void PerformStart()
 {
     this.dragItem        = this.Context as RadPageViewItem;
     this.insertHintImage = this.owner.ItemDragHint;
     if (this.owner.ItemDragMode == PageViewItemDragMode.Preview)
     {
         this.PrepareInsertHint();
     }
     base.PerformStart();
 }
Exemplo n.º 2
0
 protected override void PerformStop()
 {
     base.PerformStop();
     this.owner.EndItemDrag(this.dragItem);
     this.dragItem        = (RadPageViewItem)null;
     this.insertHintImage = (RadImageShape)null;
     if (this.insertHint == null)
     {
         return;
     }
     this.insertHint.Dispose();
     this.insertHint = (RadLayeredWindow)null;
 }
Exemplo n.º 3
0
        protected override void PerformStop()
        {
            base.PerformStop();

            this.owner.EndItemDrag(this.dragItem);

            this.dragItem        = null;
            this.insertHintImage = null;

            if (this.insertHint != null)
            {
                this.insertHint.Dispose();
                this.insertHint = null;
            }
        }
Exemplo n.º 4
0
        protected virtual void UpdateHintPosition(Point mousePosition)
        {
            TreeNodeElement dropTarget = this.DropTarget as TreeNodeElement;
            Rectangle       screen     = dropTarget.ElementTree.Control.RectangleToScreen(dropTarget.ControlBoundingRectangle);
            Padding         padding    = Padding.Empty;
            int             num1       = 1;

            if (this.DropHintColor == Color.Empty)
            {
                RadImageShape itemDropHint = this.owner.ItemDropHint;
                num1    = itemDropHint.Image.Size.Height;
                padding = itemDropHint.Margins;
            }
            int   num2           = dropTarget.PointFromScreen(mousePosition).Y <= dropTarget.Size.Height / 2 ? screen.Y : screen.Bottom;
            Point screenLocation = new Point(screen.X - padding.Left, num2 - num1 / 2);

            this.dropHintWindow.TopMost = true;
            this.dropHintWindow.ShowWindow(screenLocation);
        }
Exemplo n.º 5
0
        public override Point GetDragHintLocation(
            BaseListViewVisualItem visualItem,
            Point mouseLocation)
        {
            if (this.Orientation == Orientation.Horizontal)
            {
                return(base.GetDragHintLocation(visualItem, mouseLocation));
            }
            Rectangle     screen   = visualItem.ElementTree.Control.RectangleToScreen(visualItem.ControlBoundingRectangle);
            Padding       empty    = Padding.Empty;
            RadImageShape dragHint = this.DragHint;

            if (dragHint == null)
            {
                return(Point.Empty);
            }
            int     width   = dragHint.Image.Size.Width;
            Padding margins = dragHint.Margins;

            return(new Point((mouseLocation.X <= visualItem.Size.Width / 2 ? screen.X : screen.Right) - width / 2, screen.Y - margins.Top));
        }
Exemplo n.º 6
0
        protected virtual void UpdateHintPosition(Point mousePosition)
        {
            TreeNodeElement nodeElement = this.DropTarget as TreeNodeElement;
            Rectangle       itemBounds  = nodeElement.ElementTree.Control.RectangleToScreen(nodeElement.ControlBoundingRectangle);
            Padding         margins     = Padding.Empty;
            int             imageHeight = 1;

            if (this.DropHintColor == Color.Empty)
            {
                RadImageShape imageShape = this.owner.ItemDropHint;
                imageHeight = imageShape.Image.Size.Height;
                margins     = imageShape.Margins;
            }


            Point client      = nodeElement.PointFromScreen(mousePosition);
            bool  isDropAtTop = client.Y <= nodeElement.Size.Height / 2;
            int   y           = isDropAtTop ? itemBounds.Y : itemBounds.Bottom;
            Point hitLocation = new Point(itemBounds.X - margins.Left, y - imageHeight / 2);

            this.dropHintWindow.ShowWindow(hitLocation);
        }
Exemplo n.º 7
0
        protected override void PrePaintElement(IGraphics graphics)
        {
            //update the RotateFlip property of the image shape (if any)
            RadImageShape  background = this.BackgroundShape;
            RotateFlipType rotateFlip = RotateFlipType.RotateNoneFlipNone;
            Padding        padding    = Padding.Empty;

            if (background != null)
            {
                rotateFlip = background.RotateFlip;
                padding    = background.Padding;

                switch (this.borderAndFillOrientation)
                {
                case PageViewContentOrientation.Horizontal180:
                    background.RotateFlip = RotateFlipType.Rotate180FlipNone;
                    background.Padding    = new Padding(padding.Right, padding.Bottom, padding.Left, padding.Top);
                    break;

                case PageViewContentOrientation.Vertical90:
                    background.RotateFlip = RotateFlipType.Rotate90FlipNone;
                    background.Padding    = new Padding(padding.Bottom, padding.Left, padding.Top, padding.Right);
                    break;

                case PageViewContentOrientation.Vertical270:
                    background.RotateFlip = RotateFlipType.Rotate270FlipNone;
                    background.Padding    = new Padding(padding.Top, padding.Right, padding.Bottom, padding.Left);
                    break;
                }
            }

            base.PrePaintElement(graphics);

            if (background != null)
            {
                background.RotateFlip = rotateFlip;
                background.Padding    = padding;
            }
        }
        public override void DrawSeriesParts()
        {
            CustomCartesianRenderer customRenderer = this.Renderer as CustomCartesianRenderer;
            Graphics       graphics    = customRenderer.Graphics;
            RadGdiGraphics radGraphics = new RadGdiGraphics(graphics);

            for (int j = 0; j < this.Element.DataPoints.Count; j++)
            {
                DataPoint dataPoint = this.Element.DataPoints[j];
                RadRect   slot      = dataPoint.LayoutSlot;

                if ((bool)dataPoint.GetType().GetField("isEmpty", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(dataPoint))
                {
                    continue;
                }

                RectangleF barBounds      = new RectangleF((float)(this.OffsetX + slot.X), (float)(this.OffsetY + slot.Y), (float)slot.Width, (float)slot.Height);
                bool       isAreaVertical = (((CartesianSeries)this.Element).Parent as CartesianArea).Orientation == System.Windows.Forms.Orientation.Vertical;

                DataPointElement childElement = (DataPointElement)this.Element.Children[j];

                if (isAreaVertical)
                {
                    float realHeight = barBounds.Height * childElement.HeightAspectRatio;
                    barBounds.Y     += barBounds.Height - realHeight;
                    barBounds.Height = realHeight;
                }
                else
                {
                    float realWidth = barBounds.Width * childElement.HeightAspectRatio;
                    barBounds.Width = realWidth;
                }

                barBounds = AdjustBarDataPointBounds(childElement, barBounds);

                if (isAreaVertical)
                {
                    barBounds.Width = Math.Max(barBounds.Width, 1f);
                }
                else
                {
                    barBounds.Height = Math.Max(barBounds.Height, 1f);
                }

                RadImageShape background = childElement.BackgroundShape;

                if (background != null)
                {
                    background.Paint(graphics, barBounds);
                }

                FillPrimitiveImpl fill = new FillPrimitiveImpl(childElement, null);
                fill.PaintFill(radGraphics, 0, new SizeF(1, 1), barBounds);

                BorderPrimitiveImpl border = new BorderPrimitiveImpl(childElement, null);
                border.PaintBorder(radGraphics, 0, new SizeF(1, 1), barBounds);

                if (childElement.Image != null)
                {
                    graphics.SetClip(barBounds);
                    ImagePrimitiveImpl pointImage = new ImagePrimitiveImpl(childElement);
                    pointImage.PaintImage(radGraphics, childElement.Image, barBounds, childElement.ImageLayout, childElement.ImageAlignment, childElement.ImageOpacity, false);
                    graphics.ResetClip();
                }

                float xOffset = 20;
                float yOffset = 20;

                GraphicsPath  path  = new GraphicsPath();
                List <PointF> lines = new List <PointF>();
                lines.Add(new PointF(barBounds.Right, barBounds.Y));
                lines.Add(new PointF(barBounds.Right + xOffset, barBounds.Y - yOffset));
                lines.Add(new PointF(barBounds.Right + xOffset, barBounds.Bottom - yOffset));
                lines.Add(new PointF(barBounds.Right, barBounds.Bottom));
                path.AddLines(lines.ToArray());
                path.CloseFigure();

                using (Pen pen = new Pen(this.Element.BorderColor), pen2 = new Pen(Color.FromArgb(100, Color.Black)))
                {
                    graphics.DrawPath(pen, path);
                    graphics.DrawPath(pen2, path);
                }

                using (Brush brush = new SolidBrush(this.Element.BackColor), brush2 = new SolidBrush(Color.FromArgb(100, Color.Black)))
                {
                    graphics.FillPath(brush, path);
                    graphics.FillPath(brush2, path);
                }

                if (this.DrawCap)
                {
                    path  = new GraphicsPath();
                    lines = new List <PointF>();
                    lines.Add(new PointF(barBounds.X, barBounds.Y));
                    lines.Add(new PointF(barBounds.X + xOffset, barBounds.Y - yOffset));
                    lines.Add(new PointF(barBounds.Right + xOffset, barBounds.Y - yOffset));
                    lines.Add(new PointF(barBounds.Right, barBounds.Y));
                    path.AddLines(lines.ToArray());
                    path.CloseFigure();

                    using (Pen pen = new Pen(this.Element.BorderColor), pen2 = new Pen(Color.FromArgb(100, Color.White)))
                    {
                        graphics.DrawPath(pen, path);
                        graphics.DrawPath(pen2, path);
                    }

                    using (Brush brush = new SolidBrush(this.Element.BackColor), brush2 = new SolidBrush(Color.FromArgb(100, Color.White)))
                    {
                        graphics.FillPath(brush, path);
                        graphics.FillPath(brush2, path);
                    }

                    using (StringFormat sf = new StringFormat(StringFormat.GenericTypographic))
                    {
                        object category = ((CategoricalDataPoint)dataPoint).Category;
                        string text     = customRenderer.Summaries[category].ToString();
                        SizeF  textSize = graphics.MeasureString(text, this.summaryFont);

                        RectangleF rect = ChartRenderer.ToRectangleF(slot);
                        rect.Offset(this.Element.View.Margin.Right + (rect.Width - textSize.Width) / 2, this.Element.View.Margin.Top + textSize.Height - 10);
                        radGraphics.DrawString(text, rect, this.summaryFont, Color.Black, sf, System.Windows.Forms.Orientation.Horizontal, false);
                    }
                }
            }
        }