Exemplo n.º 1
0
 public void setPenColor(Color color)
 {
     pen.Color = color;
     if (pen.Equals(pen2))
     {
         color2.BackColor = color;
     }
     else
     {
         color1.BackColor = color;
     }
 }
Exemplo n.º 2
0
        private void DrawRoutes(Graphics g, List <NodeCanvasItem> itemFocused, out List <Route> routes)
        {
            routes = new List <Route>();

            float thickness = Math.Min((2 / zoom), 4);
            Pen   pen       = new Pen(Color.FromArgb(128, 0, 0, 0), thickness);
            Pen   penTo     = new Pen(Color.OrangeRed, thickness + 0.5f);
            Pen   penFrom   = new Pen(Color.Blue, thickness + 0.5f);

            bool nodeSelected = wireOnlySelect && NodeIsSelected;

            foreach (Route route in diagramRouter.Routes)
            {
                bool ifocus = false;
                Pen  pn     = pen;
                // подсветка линий для выбранных нод
                foreach (NodeCanvasItem item in itemFocused)
                {
                    if (item.Equals((NodeCanvasItem)route.To))
                    {
                        pn = penFrom;
                        break;
                    }
                    if (item.Equals((NodeCanvasItem)route.From))
                    {
                        routes.Add(route);
                        pn     = penTo;
                        ifocus = true;
                        break;
                    }
                }

                route.Recalc(itemsList as IEnumerable <IRectangle>);
                PointF         origin   = route.GetStartPoint();
                RouteSegment[] segments = route.RouteSegments;

                if (nodeSelected && pn.Equals(pen))
                {
                    continue;
                }

                foreach (RouteSegment rs in segments)
                {
                    PointF dest = rs.CreateDestinationPoint(origin);
                    g.DrawLine(pn, origin, dest);
                    origin = dest;
                }

                if (route.EndShape != null)
                {
                    ((RouteShape)route.EndShape).Draw(g, route, true);
                }

                if (!ifocus && route.StartShape != null && ((NodeCanvasItem)route.From).Collapsed == false)
                {
                    ((RouteShape)route.StartShape).Draw(g, route, false);
                }
            }
        }
Exemplo n.º 3
0
        internal bool HasSameColor(Pen choosenColor, Pen penColor)
        {
            bool theSame = false;

            if (choosenColor.Equals(penColor))
            {
                theSame = true;
            }

            return(theSame);
        }
Exemplo n.º 4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="gTag"></param>
 /// <param name="col"></param>
 internal void SetGraphMenuColourTick(int gTag, Pen col)
 {
     if (col.Equals(Pens.Red))
     {
         SetMenuColorTick(gTag, GraphColour.Red);
     }
     else if (col.Equals(Pens.Blue))
     {
         SetMenuColorTick(gTag, GraphColour.Blue);
     }
     else if (col.Equals(Pens.Green))
     {
         SetMenuColorTick(gTag, GraphColour.Green);
     }
     else if (col.Equals(Pens.LightGreen))
     {
         SetMenuColorTick(gTag, GraphColour.LightGreen);
     }
     else if (col.Equals(Pens.Black))
     {
         SetMenuColorTick(gTag, GraphColour.Black);
     }
     else if (col.Equals(Pens.Brown))
     {
         SetMenuColorTick(gTag, GraphColour.Brown);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Compare the values of thhe properties in the two TextDecoration objects
 /// </summary>
 /// <param name="textDecoration">The TextDecoration object to be compared against</param>
 /// <returns>True if their property values are equal. False otherwise</returns>
 /// <remarks>
 /// The method doesn't check "full" equality as it can not take into account of all the possible
 /// values associated with the DependencyObject,such as Animation, DataBinding and Attached property.
 /// It only compares the public properties to serve the specific Framework's needs in inline property
 /// management and Editing serialization.
 /// </remarks>
 internal bool ValueEquals(TextDecoration textDecoration)
 {
     if (textDecoration == null)
     {
         return(false); // o is either null or not a TextDecoration object.
     }
     if (this == textDecoration)
     {
         return(true); // reference equality.
     }
     return(
         Location == textDecoration.Location &&
         PenOffset == textDecoration.PenOffset &&
         PenOffsetUnit == textDecoration.PenOffsetUnit &&
         PenThicknessUnit == textDecoration.PenThicknessUnit &&
         (Pen == null ? textDecoration.Pen == null : Pen.Equals(textDecoration.Pen))
         );
 }
Exemplo n.º 6
0
 private bool myPen(Pen p)
 {
     return(p.Equals(colour));
 }