public void DrawMarker(DragDropMarkerRendererEventArgs e)
        {
            Graphics g = e.Graphics;
            Rectangle bounds = e.Bounds;
            if (bounds.IsEmpty || _MarkerColor.IsEmpty) return;

            if (bounds.Width == AdvTree.DragInsertMarkSize) // Vertical insert mark
            {
                using (SolidBrush brush = new SolidBrush(_MarkerColor))
                {
                    using (Pen pen = new Pen(brush, 1))
                    {
                        Point p = new Point(bounds.X + 4, bounds.Y);
                        g.DrawLine(pen, p.X, p.Y, p.X, bounds.Bottom - 1);
                    }

                    using (GraphicsPath path = new GraphicsPath())
                    {
                        path.AddLine(bounds.X, bounds.Y, bounds.X + 8, bounds.Y );
                        path.AddLine(bounds.X + 8, bounds.Y, bounds.X + 4, bounds.Y + 4);
                        path.CloseAllFigures();
                        g.FillPath(brush, path);
                    }
                    using (GraphicsPath path = new GraphicsPath())
                    {
                        path.AddLine(bounds.X, bounds.Bottom, bounds.X + 8, bounds.Bottom);
                        path.AddLine(bounds.X + 8, bounds.Bottom, bounds.X + 4, bounds.Bottom - 4);
                        path.CloseAllFigures();
                        g.FillPath(brush, path);
                    }
                }
            }
            else
            {
                // Horizontal insert mark
                using (SolidBrush brush = new SolidBrush(_MarkerColor))
                {
                    using (Pen pen = new Pen(brush, 1))
                    {
                        Point p = new Point(bounds.X, bounds.Y + 4);
                        g.DrawLine(pen, p.X, p.Y, bounds.Right - 1, p.Y);
                    }

                    using (GraphicsPath path = new GraphicsPath())
                    {
                        path.AddLine(bounds.X, bounds.Y, bounds.X, bounds.Y + 8);
                        path.AddLine(bounds.X, bounds.Y + 8, bounds.X + 4, bounds.Y + 4);
                        path.CloseAllFigures();
                        g.FillPath(brush, path);
                    }
                    using (GraphicsPath path = new GraphicsPath())
                    {
                        path.AddLine(bounds.Right, bounds.Y, bounds.Right, bounds.Y + 8);
                        path.AddLine(bounds.Right, bounds.Y + 8, bounds.Right - 4, bounds.Y + 4);
                        path.CloseAllFigures();
                        g.FillPath(brush, path);
                    }
                }
            }
        }
Exemple #2
0
		/// <summary>
		/// Raises RenderDragDropMarker event.
		/// </summary>
		/// <param name="e">Event data.</param>
        protected virtual void OnRenderDragDropMarker(DragDropMarkerRendererEventArgs e)
		{
            if (RenderDragDropMarker != null)
                RenderDragDropMarker(this, e);
		}
Exemple #3
0
        /// <summary>
        /// Draws the drag &amp; drop marker that indicates the insertion point for the node. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
        /// do not want default rendering to occur do not call the base implementation. You can call OnRenderDragDropMarker method so events can occur.
		/// </summary>
		/// <param name="e">Information provided for rendering.</param>
        public virtual void DrawDragDropMarker(DragDropMarkerRendererEventArgs e)
		{
            OnRenderDragDropMarker(e);
		}