private static LinePattern GetApplyingLinePattern(LinePattern context, LinePattern lastLinePattern,
                                                   string currentLine)
 {
     return(lastLinePattern
            .GetFollowingLinePatterns(context)
            .FirstOrDefault(linePattern => linePattern.IsApplyingTo(currentLine)));
 }
示例#2
0
        private static ElementId GetDash(this Document doc)
        {
            var collector = new FilteredElementCollector(doc)
                            .OfClass(typeof(LinePatternElement))
                            .ToElementIds().ToList();

            foreach (var id in collector)
            {
                LinePatternElement lpe  = doc.GetElement(id) as LinePatternElement;
                string             name = lpe.Name;
                if (lpe.Name == "Dash")
                {
                    return(lpe.Id);
                }
            }
            LinePattern lp = new LinePattern("Dash");

            List <LinePatternSegment> Segments = new List <LinePatternSegment>();

            Segments.Add(new LinePatternSegment(LinePatternSegmentType.Dash, 0.05));
            Segments.Add(new LinePatternSegment(LinePatternSegmentType.Space, 0.05));
            lp.SetSegments(Segments);

            LinePatternElement lped = LinePatternElement.Create(doc, lp);

            return(lped.Id);
        }
示例#3
0
        public virtual void PrintAssociation(string type1, string label1, EndType endType1,
                                             string type2, string label2, EndType endType2,
                                             string name, int size = 2, LinePattern pattern = LinePattern.Solid)
        {
            this.printer.Print(type1);

            if (!string.IsNullOrEmpty(label1))
            {
                this.printer.PrintFormat(" \"{0}\"", label1);
            }

            this.printer.PrintFormat(" {0}{1}{2}",
                                     endType1.GetLeftSymbol(),
                                     pattern.GetSymbol().Repit(size),
                                     endType2.GetRightSymbol());

            if (!string.IsNullOrEmpty(label2))
            {
                this.printer.PrintFormat(" \"{0}\"", label2);
            }

            this.printer.PrintFormat(" {0}", type2);

            if (!string.IsNullOrEmpty(name))
            {
                this.printer.PrintFormat(" : {0}", name);
            }
            this.printer.PrintLn();
        }
示例#4
0
        static string GetBorderPatternGeometry(LinePattern pattern)
        {
            switch (pattern)
            {
            case LinePattern.Solid:
                return(Strings.line_solid);

            case LinePattern.Dash:
                return(Strings.line_dash);

            case LinePattern.Dot:
                return(Strings.line_dot);

            case LinePattern.DashDot:
                return(Strings.line_dashdot);

            case LinePattern.DashDotDot:
                return(Strings.line_dashdotdot);

            case LinePattern.Rail:
                return(Strings.line_rail);

            case LinePattern.BORDER:
                return(Strings.line_border);

            case LinePattern.DIVIDE:
                return(Strings.line_divide);

            case LinePattern.FENCELINE1:
                return(Strings.line_fenceline1);

            default:
                throw new Exception("Unsupported or unrecognized border pattern: " + pattern.ToString());
            }
        }
示例#5
0
        internal static void SetShapePattern(Shape shape, LinePattern pattern)
        {
            switch (pattern)
            {
            case LinePattern.Dash:
                shape.StrokeDashArray = new DoubleCollection {
                    4, 3
                };
                break;

            case LinePattern.Dot:
                shape.StrokeDashArray = new DoubleCollection {
                    1, 2
                };
                break;

            case LinePattern.DashDot:
                shape.StrokeDashArray = new DoubleCollection {
                    4, 2, 1, 2
                };
                break;

            case LinePattern.None:
                shape.Stroke = Brushes.Transparent;
                break;

            case LinePattern.Solid:
                shape.StrokeDashArray = null;
                break;
            }
        }
示例#6
0
        /// <inheritdoc />
        public string Process(string input)
        {
            input = LinePattern.Replace(input, string.Empty);
            input = BlockPattern.Replace(input, string.Empty);

            return(input);
        }
示例#7
0
 internal CompositeLine(LinePattern pattern)
 {
     _pattern = pattern;
     if (pattern == null)
     {
         throw new NullReferenceException("Internal reference is null");
     }
 }
        private void LeftMinorCombo_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            NStandardScaleConfigurator scaleConfigurator = (NStandardScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
            LinePattern pattern = GetPatternFromIndex(LeftMinorCombo.SelectedIndex);

            scaleConfigurator.MinorGridStyle.LineStyle.Pattern = pattern;

            nChartControl1.Refresh();
        }
示例#9
0
文件: Line.cs 项目: SOFAgh/CADability
 public override void SetObjectData(IJsonReadData data)
 {
     base.SetObjectData(data);
     startPoint  = data.GetProperty <GeoPoint>("StartPoint");
     endPoint    = data.GetProperty <GeoPoint>("EndPoint");
     colorDef    = data.GetPropertyOrDefault <ColorDef>("ColorDef");
     lineWidth   = data.GetPropertyOrDefault <LineWidth>("LineWidth");
     linePattern = data.GetPropertyOrDefault <LinePattern>("LinePattern");
 }
 internal void SetStrokePattern(LinePattern pattern, bool forceSet)
 {
     if (_strokePatternSet && !forceSet)
     {
         return;
     }
     _strokePattern    = pattern;
     _strokePatternSet = true;
 }
            public IEnumerable <LinePattern> GetFollowingLinePatterns(LinePattern context)
            {
                if (context == null || !_contextfollowingLinePatterns.ContainsKey(context))
                {
                    return(_followingLinePatterns);
                }

                return(_contextfollowingLinePatterns[context]);
            }
示例#12
0
        public static void FormatAOI(Shapefile aoiShapeFile)
        {
            aoiShapeFile.DefaultDrawingOptions.FillTransparency = 0.25F;

            LinePattern lp = new LinePattern();


            MapWindowManager.MapLayersHandler.ClearAllSelections();
            MapWindowManager.RedrawMap();
        }
示例#13
0
        private static ElementId[] GetLineStyles(this Document doc)
        {
            ElementId[] eids      = new ElementId[5];
            var         collector = new FilteredElementCollector(doc)
                                    .OfClass(typeof(LinePatternElement))
                                    .ToElementIds().ToList();

            bool[] check = new bool[5] {
                false, false, false, false, false
            };
            foreach (var id in collector)
            {
                LinePatternElement lpe  = doc.GetElement(id) as LinePatternElement;
                string             name = lpe.Name;
                if (Names.Contains(name))
                {
                    check[Names.ToList().IndexOf(name)] = true;
                    eids[Names.ToList().IndexOf(name)]  = lpe.Id;
                }
            }
            if (!check[0])
            {
                eids[0] = LinePatternElement.GetSolidPatternId();
            }
            if (!check[1])
            {
                TaskDialog.Show("Test", "Dash Trying to be Created");
                LinePattern lp = new LinePattern("Dash");
                lp.SetSegments(CreateDash());
                LinePatternElement lpe = LinePatternElement.Create(doc, lp);
                eids[1] = lpe.Id;
            }
            if (!check[2])
            {
                LinePattern lp = new LinePattern("Dot");
                lp.SetSegments(CreateDot());
                LinePatternElement lpe = LinePatternElement.Create(doc, lp);
                eids[2] = lpe.Id;
            }
            if (!check[3])
            {
                LinePattern lp = new LinePattern("Center");
                lp.SetSegments(CreateCenter());
                LinePatternElement lpe = LinePatternElement.Create(doc, lp);
                eids[3] = lpe.Id;
            }
            if (!check[4])
            {
                LinePattern lp = new LinePattern("Hidden");
                lp.SetSegments(CreateHidden());
                LinePatternElement lpe = LinePatternElement.Create(doc, lp);
                eids[4] = lpe.Id;
            }
            return(eids);
        }
示例#14
0
        public override void createStyle(Shapefile sf)
        {
            LinePattern pattern = new LinePattern();

            pattern.AddLine(utils.ColorByName(tkMapColor.Black), 6.0f, tkDashStyle.dsSolid);
            pattern.AddLine(utils.ColorByName(tkMapColor.White), 5.0f, tkDashStyle.dsDot);


            ShapeDrawingOptions options = sf.DefaultDrawingOptions;


            // standard fill
            options.FillTransparency = 50;
            options.LineWidth        = 3;
            options.LineVisible      = true;
            options.LineColor        = utils.ColorByName(tkMapColor.Blue);
            options.LineStipple      = tkDashStyle.dsSolid;

            /*
             * addExpression(sf, "Casa madera y/o adobe", "[Name] = \"Casa madera y/o adobe\"", "rgb(37, 49, 232)");
             * addExpression(sf, "Casa ladrillo", "[Name] = \"Casa ladrillo\"", "rgb(13, 22, 168)");
             * addExpression(sf, "Escuela", "[Name] = \"Escuela estándar (muros de concreto)\"", "rgb(19, 25, 117)");
             * addExpression(sf, "Iglesia", "[Name] = \"Iglesia\"", "rgb(80, 88, 178)");
             * addExpression(sf, "Colegio", "[Name] = \"Colegio estatal\"", "rgb(50, 92, 163)");
             * addExpression(sf, "Tanque", "[Name] = \"Tanque de agua\"", "rgb(33, 91, 188)");
             * addExpression(sf, "Molino", "[Name] = \"Molino\"", "rgb(25, 66, 135)");
             * addExpression(sf, "Taller", "[Name] = \"Taller de bicicleta\"", "rgb(57, 66, 168)");
             * addExpression(sf, "Adminis", "[Name] = \"Edificio de administración\"", "rgb(65, 51, 155)");
             * addExpression(sf, "Mercado", "[Name] = \"Mercado\"", "rgb(26, 34, 127)");
             * addExpression(sf, "Hospital", "[Name] = \"Hospital\"", "rgb(57, 62, 119)");
             * addExpression(sf, "Escuela principal", "[Name] = \"Escuela principal\"", "rgb(40, 96, 186)");
             * addExpression(sf, "Puesto", "[Name] = \"Puesto de salud\"", "rgb(96, 36, 153)");
             *
             * addExpression(sf, "Infraestructura", "[Name] = \"Infraestructura de comunicación\"", "rgb(74, 39, 107)");
             * addExpression(sf, "Tubería", "[Name] = \"Tubería de agua al aire libre\"", "rgb(60, 22, 96)");
             * addExpression(sf, "Aeropuerto", "[Name] = \"Terminal / Aeropuerto\"", "rgb(63, 11, 112)");
             *
             * addExpression(sf, "Carretera", "[Name] = \"Carretera principal (pavimentada)\"", "rgb(103, 152, 198)");
             * addExpression(sf, "Camino", "[Name] = \"Camino comunitario (para vehiculos, no pavimentado)\"", "rgb(51, 97, 140)");
             * addExpression(sf, "Puente", "[Name] = \"Puente comunitario (para vehiculos, no pavimentado)\"", "rgb(10, 48, 84)");
             * addExpression(sf, "electrica", "[Name] = \"Línea electrica (incluyendo postes)\"", "rgb(40, 134, 224)");
             * addExpression(sf, "Transformador", "[Name] = \"Transformador\"", "rgb(31, 110, 186)");
             * addExpression(sf, "Reservorio", "[Name] = \"Reservorio (incluyendo bombas)\"", "rgb(31, 152, 168)");
             * addExpression(sf, "Canal", "[Name] = \"Canal de riego\"", "rgb(26, 194, 216)");
             * addExpression(sf, "Huerto", "[Name] = \"Huerto\"", "rgb(17, 139, 155)");
             * addExpression(sf, "Campos", "[Name] = \"Campos de maíz, frijol, sorghum\"", "rgb(14, 167, 178)");
             * addExpression(sf, "Frutales", "[Name] = \"Frutales\"", "rgb(36, 133, 140)");
             * addExpression(sf, "Camaroneras", "[Name] = \"Camaroneras\"", "rgb(57, 62, 119)");
             *
             * addExpression(sf, "Pastos", "[Name] = \"Pastos, Pastizales\"", "rgb(25, 66, 135)");
             */
            addExpression(sf, "NotStandard", "[IsStandard] = 0", "rgb(255, 0, 0)");

            sf.Categories.ApplyExpressions();
        }
示例#15
0
        /// <summary>
        /// Retrieve the parent LinePattern object to the lower-level LinePatternElement object.
        /// </summary>
        /// <returns>The Revit LinePattern object (not LinePatternElement).</returns>
        public LinePattern GetLinePattern()
        {
            LinePattern linePattern = null;

            try
            {
                linePattern = LinePatternElement.GetLinePattern();
            }
            catch (Exception exceptionLinePattern) { Console.WriteLine(exceptionLinePattern.ToString()); }

            return(linePattern);
        }
        public virtual void Process(Generalization generalization, TPrinter printer)
        {
            LinePattern pattern = LinePattern.Solid;

            if (generalization.General.IsInterface && generalization.Specific.IsClass)
            {
                pattern = LinePattern.Dotted;
            }
            printer.PrintGeneralization(
                PlantUmlUtils.GetSimpleName(generalization.General),
                PlantUmlUtils.GetSimpleName(generalization.Specific),
                generalization.Name, 2, pattern);
        }
示例#17
0
文件: Line.cs 项目: SOFAgh/CADability
 /// <summary>
 /// Constructor required by deserialization
 /// </summary>
 /// <param name="info">SerializationInfo</param>
 /// <param name="context">StreamingContext</param>
 protected Line(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     startPoint  = (GeoPoint)info.GetValue("StartPoint", typeof(GeoPoint));
     endPoint    = (GeoPoint)info.GetValue("EndPoint", typeof(GeoPoint));
     colorDef    = ColorDef.Read(info, context);
     lineWidth   = LineWidth.Read("LineWidth", info, context);
     linePattern = LinePattern.Read("LinePattern", info, context);
     if (Constructed != null)
     {
         Constructed(this);
     }
 }
示例#18
0
        internal virtual void Init()
        {
            _strokeThickness = 1;
            _strokePattern   = LinePattern.Solid;
            _strokeColor     = Color.FromArgb(0xFF, 0x00, 0xFF, 0x00); //Lime

            _selectable = true;
            _selected   = false;
            _visible    = true;
            Painted     = false;
            _upColor    = null;
            _downColor  = null;
            _shareScale = true;
        }
示例#19
0
        public static string GetSymbol(this LinePattern pattern)
        {
            switch (pattern)
            {
            case LinePattern.Solid:
                return("-");

            case LinePattern.Dotted:
                return(".");

            default:
                throw new IndexOutOfRangeException();
            }
        }
示例#20
0
        internal void Initialize()
        {
            _x1               = _y1 = _x2 = _y2 = 0.0;
            _x1Value          = _y1Value = 0.0;
            _x2Value          = _y2Value = 0.0;
            _strokeThickness  = 1;
            _strokeType       = LinePattern.Solid;
            _selectable       = true;
            _selected         = false;
            _drawn            = false;
            _drawing          = false;
            _selectionVisible = false;

            ValuePresenterAlignment = ValuePresenterAlignmentType.Right;
        }
示例#21
0
        public virtual void PrintGeneralization(string general, string specific,
                                                string name, int size = 2, LinePattern pattern = LinePattern.Solid)
        {
            this.printer.Print(general);

            this.printer.PrintFormat(" {0}{1}", "<|", pattern.GetSymbol().Repit(size));

            this.printer.PrintFormat(" {0}", specific);

            if (!string.IsNullOrEmpty(name))
            {
                this.printer.PrintFormat(" : {0}", name);
            }
            this.printer.PrintLn();
        }
示例#22
0
        internal static void DrawLine(double x1, double y1, double x2, double y2, Brush strokeBrush,
                                      LinePattern strokePattern, double strokeThickness,
                                      System.Windows.Shapes.Line line)
        {
            line.X1 = x1;
            line.X2 = x2;
            line.Y1 = y1;
            line.Y2 = y2;
            if (!BrushesEqual(line.Stroke, strokeBrush))
            {
                line.Stroke = strokeBrush;
            }

            line.StrokeThickness = strokeThickness;
            Types.SetShapePattern(line, strokePattern);
        }
示例#23
0
        /// <summary>
        /// 加入样式
        /// </summary>
        private void btnAddStyle_Click(object sender, EventArgs e)
        {
            MapWinGIS.LinePattern pattern = new LinePattern();
            this.ApplyPattern();

            if (_options.UseLinePattern && _options.LinePattern != null)
            {
                string s = _options.LinePattern.Serialize();
                pattern.Deserialize(s);
            }
            else
            {
                pattern.AddLine(_options.LineColor, _options.LineWidth, _options.LineStipple);
            }
            linePatternControl1.AddPattern(pattern);
        }
示例#24
0
        // <summary>
        // Creates and displayes custom line patterns
        // </summary>
        public void LinePattern(AxMap axMap1, string iconPath)
        {
            axMap1.Projection = tkMapProjection.PROJECTION_NONE;

            var sf = this.CreateLines();

            axMap1.AddLayer(sf, true);

            var utils = new Utils();

            // railroad pattern
            LinePattern pattern = new LinePattern();

            pattern.AddLine(utils.ColorByName(tkMapColor.Black), 6.0f, tkDashStyle.dsSolid);
            pattern.AddLine(utils.ColorByName(tkMapColor.White), 5.0f, tkDashStyle.dsDot);

            ShapefileCategory ct = sf.Categories.Add("Railroad");

            ct.DrawingOptions.LinePattern    = pattern;
            ct.DrawingOptions.UseLinePattern = true;
            sf.set_ShapeCategory(0, 0);

            // river pattern
            pattern = new LinePattern();
            pattern.AddLine(utils.ColorByName(tkMapColor.DarkBlue), 6.0f, tkDashStyle.dsSolid);
            pattern.AddLine(utils.ColorByName(tkMapColor.LightBlue), 4.0f, tkDashStyle.dsSolid);

            ct = sf.Categories.Add("River");
            ct.DrawingOptions.LinePattern    = pattern;
            ct.DrawingOptions.UseLinePattern = true;
            sf.set_ShapeCategory(1, 1);

            // road with direction
            pattern = new LinePattern();
            pattern.AddLine(utils.ColorByName(tkMapColor.Gray), 8.0f, tkDashStyle.dsSolid);
            pattern.AddLine(utils.ColorByName(tkMapColor.Yellow), 7.0f, tkDashStyle.dsSolid);
            LineSegment segm = pattern.AddMarker(tkDefaultPointSymbol.dpsArrowRight);

            segm.Color          = utils.ColorByName(tkMapColor.Orange);
            segm.MarkerSize     = 10;
            segm.MarkerInterval = 32;

            ct = sf.Categories.Add("Direction");
            ct.DrawingOptions.LinePattern    = pattern;
            ct.DrawingOptions.UseLinePattern = true;
            sf.set_ShapeCategory(2, 2);
        }
示例#25
0
        static (Records, Records) ParseFile(this string path)
        {
            Error.WriteLine($"*** parsing {path}");

            var    showActionResult = new Records();
            var    gameOverResult   = new Records();
            string line;
            int    ln = 0;

            using (var file = new StreamReader(path))
            {
                while ((line = file.ReadLine()) != null)
                {
                    ln++;
                    var match = LinePattern.Match(line);
                    if (!match.Success || match.Groups["level"].Value != "INFO")
                    {
                        continue;
                    }
                    var match2 = EventPattern.Match(match.Groups["message"].Value);
                    if (!match2.Success || !new[] { "SHOW_ACTION", "GAME_OVER" }.Contains(match2.Groups["event"].Value))
                    {
                        continue;
                    }
                    var record = Record.Parse(match2.Groups["json"].Value, path, ln);
                    if (record != null && record.data.Canonicalize())
                    {
                        switch (match2.Groups["event"].Value)
                        {
                        case "SHOW_ACTION":
                            showActionResult[DateTime.Parse(match.Groups["time"].Value)] = record;
                            break;

                        case "GAME_OVER":
                            gameOverResult[DateTime.Parse(match.Groups["time"].Value)] = record;
                            break;
                        }
                    }
                }
            }
            if (showActionResult.Count == 0 && gameOverResult.Count == 0)
            {
                Error.WriteLine("    Deleting the file because it contains no useful data");
                File.Delete(path);
            }
            return(showActionResult, gameOverResult);
        }
        public static DoubleCollection GetLinePattern(LinePattern pattern)
        {
            switch (pattern)
            {
            case LinePattern.Dot:
                return(new DoubleCollection(new double[] { 1, 2 }));

            case LinePattern.Dash:
                return(new DoubleCollection(new double[] { 4, 3 }));

            case LinePattern.DashDot:
                return(new DoubleCollection(new double[] { 4, 2, 1, 2 }));

            default:
                throw new ArgumentOutOfRangeException(nameof(pattern), pattern, null);
            }
        }
示例#27
0
 private void OnMultiLinePatternSelectionChanged(LinePattern selected)
 {
     isChangingMultipleAttributes = true;
     using (frame.Project.Undo.UndoFrame)
     {
         for (int i = 0; i < selectedObjects.Count; ++i)
         {
             ILinePattern ilp = selectedObjects[i] as ILinePattern;
             if (ilp != null)
             {
                 ilp.LinePattern = selected;
             }
         }
     }
     isChangingMultipleAttributes = false;
     MultiChangeDone();
 }
示例#28
0
 /// <summary>
 /// A Linestyle is a Document Setting in Revit, not a typical object. The Category object contains the Linestyle information.
 /// </summary>
 /// <param name="doc">The Revit Document object.</param>
 /// <param name="subCategoryLinestyle">Revit Category object.</param>
 public LinestyleST(Document doc, Category subCategoryLinestyle)
 {
     Doc = doc;
     SubCategoryLinestyle        = subCategoryLinestyle;
     LineStyleName               = SubCategoryLinestyle.Name;
     LineStyleId                 = SubCategoryLinestyle.Id;
     LineStyleWeight             = SubCategoryLinestyle.GetLineWeight(GraphicsStyleType.Projection).ToString();
     LineStyleRgb                = GetLineStyleRgb();
     LinePatternId               = GetLinePatternId();
     LinePatternName             = GetLinePatternName();
     LinePatternElement          = GetLinePatternElement();
     LinePattern                 = GetLinePattern();
     LinePatternComponentsLength = GetLinePatternSegmentLengths();
     LinePatternComponentsType   = GetLinePatternSegmentTypes();
     Serialized = JsonConvert.SerializeObject(this);
     JsonObject = JObject.Parse(Serialized);
 }
            public LinePattern CanBeFollowedBySameAs(LinePattern linePattern)
            {
                if (_context == null)
                {
                    _followingLinePatterns.AddRange(linePattern._followingLinePatterns);
                    return(this);
                }

                if (!_contextfollowingLinePatterns.ContainsKey(_context))
                {
                    _contextfollowingLinePatterns.Add(_context, new List <LinePattern>());
                }

                _contextfollowingLinePatterns[_context].AddRange(linePattern._followingLinePatterns);

                return(this);
            }
示例#30
0
        /// <summary>
        /// Adds current options as a style to the list
        /// </summary>
        private void btnAddStyle_Click(object sender, EventArgs e)
        {
            MapWinGIS.LinePattern pattern = new LinePattern();
            this.ApplyPattern();

            if (_options.UseLinePattern && _options.LinePattern != null)
            {
                string s = _options.LinePattern.Serialize();
                pattern.Deserialize(s);
            }
            else
            {
                // there is no actual patter, a single line only;
                // pattern object should be created on the fly
                pattern.AddLine(_options.LineColor, _options.LineWidth, _options.LineStipple);
            }
            linePatternControl1.AddPattern(pattern);
        }
示例#31
0
        /// <summary>
        /// Applies the style to instance of this style.
        /// </summary>
        /// <param name="style">Style to apply.</param>
        public void ApplyStyle(GridPanelVisualStyle style)
        {
            if (style != null)
            {
                base.ApplyStyle(style);

                if (style.Alignment != Alignment.NotSet)
                    _Alignment = style.Alignment;

                if (style.AllowWrap != Tbool.NotSet)
                    _AllowWrap = style.AllowWrap;

                if (style._CircleTreeButtonStyle != null)
                    CircleTreeButtonStyle.ApplyStyle(style._CircleTreeButtonStyle);

                if (style.HeaderLineColor.IsEmpty == false)
                    _HeaderLineColor = style.HeaderLineColor;

                if (style.TreeLineColor.IsEmpty == false)
                    _TreeLineColor = style.TreeLineColor;

                if (style.HorizontalLineColor.IsEmpty == false)
                    _HorizontalLineColor = style.HorizontalLineColor;

                if (style.VerticalLineColor.IsEmpty == false)
                    _VerticalLineColor = style.VerticalLineColor;

                if (style.TreeLinePattern != LinePattern.NotSet)
                    TreeLinePattern = style.TreeLinePattern;

                if (style.HorizontalLinePattern != LinePattern.NotSet)
                    HorizontalLinePattern = style.HorizontalLinePattern;

                if (style._SquareTreeButtonStyle != null)
                    SquareTreeButtonStyle.ApplyStyle(style._SquareTreeButtonStyle);

                if (style._TriangleTreeButtonStyle != null)
                    TriangleTreeButtonStyle.ApplyStyle(style._TriangleTreeButtonStyle);
                
                if (style.VerticalLinePattern != LinePattern.NotSet)
                    VerticalLinePattern = style.VerticalLinePattern;

                if (style.HeaderHLinePattern != LinePattern.NotSet)
                    HeaderHLinePattern = style.HeaderHLinePattern;

                if (style.HeaderVLinePattern != LinePattern.NotSet)
                    HeaderVLinePattern = style.HeaderVLinePattern;
            }
        }
示例#32
0
        private Pen GetBorderPen(IEnumerable<Pen> pens,
            Color color, int width, LinePattern pattern)
        {
            if (color.IsEmpty == true ||
                pattern == LinePattern.None || width <= 0)
            {
                return (null);
            }

            foreach (Pen pen in pens)
            {
                if (pen != null)
                {
                    if (pen.Color == color && pen.Width == width &&
                        pen.DashStyle == (DashStyle)pattern)
                    {
                        return (pen);
                    }
                }
            }

            Pen npen = new Pen(color, width);

            if (pattern == LinePattern.NotSet)
                pattern = LinePattern.Solid;

            npen.DashStyle = (DashStyle)pattern;

            return (npen);
        }
 public void SetLinePattern(
     DependencyObject obj,
     LinePattern value)
 {
     obj.SetValue(LinePatternProperty, value);
 }