Beispiel #1
0
        public static Pen GetPen(PenColorList type, float zoomScale)
        {
            var pen = (Pen)GetPen(type).Clone();

            pen.Width = pen.Width / zoomScale;
            return(pen);
        }
Beispiel #2
0
        public static Color GetColor(PenColorList type)
        {
            if (!_colorList.ContainsKey(type))
            {
                var value = QuickSettings.Get[string.Format("Color{0}", type)];
                if (string.IsNullOrWhiteSpace(value))
                {
                    _colorList[type] = GetDefaultColor(type);
                }
                else
                {
                    try
                    {
                        if (value.Contains(','))
                        {
                            var bits = value.Split(',');
                            var r    = int.Parse(bits[0]);
                            var g    = int.Parse(bits[1]);
                            var b    = int.Parse(bits[2]);
                            _colorList[type] = Color.FromArgb(r, g, b);
                        }
                        else
                        {
                            _colorList[type] = Color.FromName(value);
                        }
                    }
                    catch (Exception)
                    {
                        _colorList[type] = GetDefaultColor(type);
                    }
                }
            }

            return(_colorList[type]);
        }
        public static void SetColor(PenColorList type, Color newColor)
        {
            #region Code
            var value = Convert.ToString(newColor);
            if (_colorList.ContainsKey(type))
            {
                _colorList[type] = newColor;
                if (_penList.ContainsKey(type))
                {
                    _penList[type] = new Pen(newColor, 1);
                }
                else
                {
                    _penList.Add(type, new Pen(newColor, 1));
                }
            }
            else
            {
                _colorList.Add(type, newColor);
                _penList.Add(type, new Pen(newColor, 1));
            }

            QuickSettings.Get[string.Format("Color{0}", type)] = string.Format("{0},{1},{2}", newColor.R, newColor.G, newColor.B);
            #endregion
        }
Beispiel #4
0
        public static Pen GetPen(PenColorList type)
        {
            if (!_penList.ContainsKey(type))
            {
                if (type == PenColorList.SplitLine)
                {
                    _penList[type] = new Pen(GetColor(type), 2.5f);
                }
                else if (type == PenColorList.LineHighlight)
                {
                    _penList[type] = new Pen(GetColor(type), 1.5f);
                }
                else
                {
                    _penList[type] = new Pen(GetColor(type), 1f);
                }

                var lineDrawing = QuickSettings.Get["LineDrawing"];
                if (!string.IsNullOrWhiteSpace(lineDrawing) &&
                    lineDrawing.Equals("Arrow", StringComparison.InvariantCultureIgnoreCase))
                {
                    _penList[type].StartCap = LineCap.Flat;
                    _penList[type].EndCap   = LineCap.ArrowAnchor;
                }
                else
                {
                    QuickSettings.Get["LineDrawing"] = "Arrow";
                }
            }

            return(_penList[type]);
        }
Beispiel #5
0
 public static Brush GetBrush(PenColorList type)
 {
     if (!_brushList.ContainsKey(type))
     {
         _brushList[type] = new SolidBrush(GetColor(type));
     }
     return(_brushList[type]);
 }
Beispiel #6
0
 private static Color GetDefaultColor(PenColorList list)
 {
     if (list == PenColorList.RapidMove)
     {
         return(Color.Red);
     }
     if (list == PenColorList.NormalMove)
     {
         return(Color.DodgerBlue);
     }
     if (list == PenColorList.CWArc)
     {
         return(Color.Lime);
     }
     if (list == PenColorList.CCWArc)
     {
         return(Color.Yellow);
     }
     if (list == PenColorList.RapidMoveHighlight)
     {
         return(Color.Pink);
     }
     if (list == PenColorList.LineHighlight)
     {
         return(Color.White);
     }
     if (list == PenColorList.Background)
     {
         return(Color.FromArgb(0x20, 0x20, 0x20));
     }
     if (list == PenColorList.GridLines)
     {
         return(Color.DimGray);
     }
     if (list == PenColorList.GridLinesHighlight)
     {
         return(Color.LightSkyBlue);
     }
     if (list == PenColorList.DrillPoint)
     {
         return(Color.Pink);
     }
     if (list == PenColorList.DrillPointHighlight)
     {
         return(Color.White);
     }
     if (list == PenColorList.SelectionHighlighted)
     {
         return(Color.White);
     }
     if (list == PenColorList.SplitLine)
     {
         return(Color.LightYellow);
     }
     return(Color.White);
 }
Beispiel #7
0
 public LinePoints(Point3D start, Point3D end, PenColorList pen)
     : this()
 {
     X1  = start.X;
     Y1  = start.Y;
     Z1  = start.Z;
     X2  = end.X;
     Y2  = end.Y;
     Z2  = end.Z;
     Pen = pen;
 }
 public LinePoints(float x1, float y1, float x2, float y2, PenColorList pen)
     : this()
 {
     #region Code
     X1  = x1;
     Y1  = y1;
     X2  = x2;
     Y2  = y2;
     Pen = pen;
     #endregion
 }
 public LinePoints(PointF start, PointF end, PenColorList pen)
     : this()
 {
     #region Code
     X1  = start.X;
     Y1  = start.Y;
     X2  = end.X;
     Y2  = end.Y;
     Pen = pen;
     #endregion
 }
Beispiel #10
0
        public static Pen GetPen(PenColorList type)
        {
            #region Code
            if (!_penList.ContainsKey(type))
            {
                if (type == PenColorList.LineHighlight)
                {
                    _penList[type] = new Pen(GetColor(type), 2f);
                }
                else
                {
                    _penList[type] = new Pen(GetColor(type), 1f);
                }
            }

            return(_penList[type]);

            #endregion
        }
Beispiel #11
0
 private static Color GetDefaultColor(PenColorList list)
 {
     if (list == PenColorList.RapidMove)
     {
         return(Color.Red);
     }
     if (list == PenColorList.NormalMove)
     {
         return(Color.DodgerBlue);
     }
     if (list == PenColorList.CWArc)
     {
         return(Color.Lime);
     }
     if (list == PenColorList.CCWArc)
     {
         return(Color.Yellow);
     }
     if (list == PenColorList.RapidMoveHilight)
     {
         return(Color.Salmon);
     }
     if (list == PenColorList.LineHighlight)
     {
         return(Color.White);
     }
     if (list == PenColorList.Background)
     {
         return(Color.FromArgb(0x20, 0x20, 0x20));
     }
     if (list == PenColorList.GridLines)
     {
         return(Color.DimGray);
     }
     return(Color.White);
 }