Exemplo n.º 1
0
		public Stroke()
		{
            _style = new LineStyle();
            _style.PropertyChanged += new PropertyChangedEventHandler(style_PropertyChanged);
            SuperColor = new InheritableColor();
		}
Exemplo n.º 2
0
        public void Cascade(LineStyle lineStyle)
		{
            if (_lineStyle != lineStyle)
            {
                if (_lineStyle != null)
                    _lineStyle.PropertyChanged += new PropertyChangedEventHandler(ParentLineStyle_PropertyChanged);
                _lineStyle = lineStyle;
                if (_lineStyle != null)
                    _lineStyle.PropertyChanged += new PropertyChangedEventHandler(ParentLineStyle_PropertyChanged);
            }

            var missing = /*lineStyle != null ? (lineStyle.Fields | lineStyle.InheritedFields) & ~Fields : */~Fields;
			if (missing == LineStyleFields.None) return;

            foreach (LineStyleFields fields in Enum.GetValues(typeof(LineStyleFields)))
				if (missing.HasFlag(fields))
					switch (fields)
					{
                        case LineStyleFields.PatternFile:
                            InheritedPatternFile = lineStyle != null ? lineStyle.PatternFile : DefPatternFile;
                            break;
                        case LineStyleFields.Width: 
                            InheritedWidth = lineStyle != null ? lineStyle.Width : DefWidth; 
                            break;
                        case LineStyleFields.DashArray:
                            InheritedDashArray = lineStyle != null ? lineStyle.DashArray : DefDashArray;
                            break;
                        case LineStyleFields.Color:
                            InheritedColor = lineStyle != null ? lineStyle.Color : DefColor;
                            break;
                        case LineStyleFields.DashOffset:
                            InheritedDashOffset = lineStyle != null ? lineStyle.DashOffset : DefDashOffset;
                            break;
                        case LineStyleFields.DashStyle:
                            InheritedDashStyle = lineStyle != null ? lineStyle.DashStyle : DefDashStyle;
                            break;
                        case LineStyleFields.Opacity:
                            InheritedOpacity = lineStyle != null ? lineStyle.Opacity : DefOpacity;
                            break;
                        case LineStyleFields.Miterlimit:
                            InheritedMiterlimit = lineStyle != null ? lineStyle.Miterlimit : DefMiterLimit;
                            break;
                        case LineStyleFields.StartCap:
                            InheritedStartCap = lineStyle != null ? lineStyle.StartCap : DefStartCap;
                            break;
                        case LineStyleFields.EndCap:
                            InheritedEndCap = lineStyle != null ? lineStyle.EndCap : DefEndCap;
                            break;
                        case LineStyleFields.Join:
                            InheritedJoin = lineStyle != null ? lineStyle.Join : DefJoin;
                            break;
					}
            //InheritedFields = missing;
        }