예제 #1
0
        /// <summary>
        /// Draw this handle according to the handle's style.
        /// </summary>
        /// <param name="g"></param>
        /// <param name="view"></param>
        /// <remarks>
        /// Handles never have shadows, but their outlines and fills
        /// can be specified by the <see cref="P:Northwoods.Go.GoShape.Pen" /> and
        /// <see cref="P:Northwoods.Go.GoShape.Brush" /> properties.
        /// Hollow handles (those with a <see cref="P:Northwoods.Go.GoHandle.GoObject" />.<c>NoHandle</c>
        /// <see cref="P:Northwoods.Go.GoHandle.HandleID" />), should have no <see cref="P:Northwoods.Go.GoShape.Brush" />.
        /// </remarks>
        public override void Paint(Graphics g, GoView view)
        {
            RectangleF bounds = Bounds;

            switch (Style)
            {
            case GoHandleStyle.None:
                break;

            default:
                GoShape.DrawRectangle(g, view, Pen, Brush, bounds.X, bounds.Y, bounds.Width, bounds.Height);
                break;

            case GoHandleStyle.Ellipse:
                GoShape.DrawEllipse(g, view, Pen, Brush, bounds.X, bounds.Y, bounds.Width, bounds.Height);
                break;

            case GoHandleStyle.Diamond:
            {
                PointF[] array2 = view.AllocTempPointArray(4);
                array2[0].X = bounds.X + bounds.Width / 2f;
                array2[0].Y = bounds.Y;
                array2[1].X = bounds.X + bounds.Width;
                array2[1].Y = bounds.Y + bounds.Height / 2f;
                array2[2].X = array2[0].X;
                array2[2].Y = bounds.Y + bounds.Height;
                array2[3].X = bounds.X;
                array2[3].Y = array2[1].Y;
                GoShape.DrawPolygon(g, view, Pen, Brush, array2);
                view.FreeTempPointArray(array2);
                break;
            }

            case GoHandleStyle.TriangleTopLeft:
            case GoHandleStyle.TriangleTopRight:
            case GoHandleStyle.TriangleBottomRight:
            case GoHandleStyle.TriangleBottomLeft:
            case GoHandleStyle.TriangleMiddleTop:
            case GoHandleStyle.TriangleMiddleRight:
            case GoHandleStyle.TriangleMiddleBottom:
            case GoHandleStyle.TriangleMiddleLeft:
            {
                PointF[] array = view.AllocTempPointArray(3);
                ComputeTrianglePoints(array);
                GoShape.DrawPolygon(g, view, Pen, Brush, array);
                view.FreeTempPointArray(array);
                break;
            }
            }
        }
예제 #2
0
 /// <summary>
 /// Unlike most ports, this kind of port will draw a drop-shadow, if expected of the parent
 /// <see cref="T:Northwoods.Go.GoBoxNode" />.
 /// </summary>
 /// <param name="g"></param>
 /// <param name="view"></param>
 public override void Paint(Graphics g, GoView view)
 {
     if (Style != 0 && base.Parent != null && base.Parent.Shadowed)
     {
         RectangleF bounds       = Bounds;
         SizeF      shadowOffset = base.Parent.GetShadowOffset(view);
         if (Brush != null)
         {
             Brush shadowBrush = base.Parent.GetShadowBrush(view);
             GoShape.DrawRectangle(g, view, null, shadowBrush, bounds.X + shadowOffset.Width, bounds.Y + shadowOffset.Height, bounds.Width, bounds.Height);
         }
         else if (Pen != null)
         {
             Pen shadowPen = base.Parent.GetShadowPen(view, GoShape.GetPenWidth(Pen));
             GoShape.DrawRectangle(g, view, shadowPen, null, bounds.X + shadowOffset.Width, bounds.Y + shadowOffset.Height, bounds.Width, bounds.Height);
         }
     }
     base.Paint(g, view);
 }
예제 #3
0
        /// <summary>
        /// Paint a possibly shadowed rectangle.
        /// </summary>
        /// <param name="g"></param>
        /// <param name="view"></param>
        public override void Paint(Graphics g, GoView view)
        {
            Brush      brush  = Brush;
            RectangleF bounds = Bounds;

            if (Shadowed)
            {
                SizeF shadowOffset = GetShadowOffset(view);
                if (brush != null)
                {
                    Brush shadowBrush = GetShadowBrush(view);
                    GoShape.DrawRectangle(g, view, null, shadowBrush, bounds.X + shadowOffset.Width, bounds.Y + shadowOffset.Height, bounds.Width, bounds.Height);
                }
                else if (Pen != null)
                {
                    Pen shadowPen = GetShadowPen(view, PenWidth);
                    GoShape.DrawRectangle(g, view, shadowPen, null, bounds.X + shadowOffset.Width, bounds.Y + shadowOffset.Height, bounds.Width, bounds.Height);
                }
            }
            GoShape.DrawRectangle(g, view, Pen, brush, bounds.X, bounds.Y, bounds.Width, bounds.Height);
        }
예제 #4
0
        /// <summary>
        /// Make sure the Control in the view exists and is positioned and sized correctly.
        /// </summary>
        /// <param name="g"></param>
        /// <param name="view"></param>
        /// <remarks>
        /// This ignores the <see cref="P:Northwoods.Go.GoObject.Shadowed" /> property.
        /// Controls are not created for <see cref="T:Northwoods.Go.GoOverview" /> views--instead
        /// they are drawn as light gray rectangles.
        /// </remarks>
        public override void Paint(Graphics g, GoView view)
        {
            if (view is GoOverview)
            {
                RectangleF bounds = Bounds;
                GoShape.DrawRectangle(g, view, GoShape.Pens_Black, GoShape.Brushes_LightGray, bounds.X, bounds.Y, bounds.Width, bounds.Height);
                return;
            }
            Control control = GetControl(view);

            if (control != null)
            {
                RectangleF bounds2 = Bounds;
                Rectangle  bounds3 = view.ConvertDocToView(bounds2);
                if (!(control is GoText.ComboBoxControl))
                {
                    control.Bounds = bounds3;
                }
                if (!control.Visible)
                {
                    control.Visible = true;
                }
            }
        }