/// <summary>
        /// Replacement for <see cref="ShapeField.GetBackgroundBrush"/> that recognizes
        /// <see cref="IDynamicColorGeometryHost"/>
        /// </summary>
        public override Pen GetPen(DiagramClientView view, ShapeElement parentShape, ref Color oldColor)
        {
            StyleSet styleSet     = (parentShape != null) ? parentShape.StyleSet : null;
            Color    restoreColor = Color.Empty;
            Pen      pen          = null;

            if (styleSet != null)
            {
                StyleSetResourceId penId = GetPenId(parentShape);
                pen = styleSet.GetPen(penId);
                IDynamicColorGeometryHost dynamicColors = parentShape as IDynamicColorGeometryHost;
                if (dynamicColors == null ||
                    (restoreColor = dynamicColors.UpdateDynamicColor(penId, pen)).IsEmpty)
                {
                    if (view != null)
                    {
                        restoreColor = parentShape.UpdateGeometryLuminosity(view, pen);
                    }
                }
                else if (view != null)
                {
                    parentShape.UpdateGeometryLuminosity(view, pen);
                }
            }
            if (pen != null && !restoreColor.IsEmpty)
            {
                restoreColor = pen.Color;
            }
            return(pen);
        }
        /// <summary>
        /// Replacement for <see cref="ShapeField.GetBackgroundBrush"/> that recognizes
        /// <see cref="IDynamicColorGeometryHost"/>
        /// </summary>
        public override Brush GetBackgroundBrush(DiagramClientView view, ShapeElement parentShape, ref Color oldColor)
        {
            StyleSet   styleSet     = (parentShape != null) ? parentShape.StyleSet : null;
            Brush      brush        = null;
            SolidBrush solidBrush   = null;;
            Color      restoreColor = Color.Empty;

            if (styleSet != null)
            {
                StyleSetResourceId brushId = GetBackgroundBrushId(view, parentShape);
                brush = styleSet.GetBrush(brushId);
                IDynamicColorGeometryHost dynamicColors = parentShape as IDynamicColorGeometryHost;
                if (dynamicColors == null ||
                    (restoreColor = dynamicColors.UpdateDynamicColor(brushId, brush)).IsEmpty)
                {
                    if (view != null)
                    {
                        restoreColor = parentShape.UpdateGeometryLuminosity(view, brush);
                    }
                }
                else if (view != null)
                {
                    parentShape.UpdateGeometryLuminosity(view, brush);
                }
            }
            if (restoreColor.IsEmpty)
            {
                if ((solidBrush ?? (solidBrush = brush as SolidBrush)) != null)
                {
                    restoreColor = solidBrush.Color;
                }
            }
            if (!restoreColor.IsEmpty)
            {
                oldColor = restoreColor;
            }
            return(brush);
        }
Ejemplo n.º 3
0
		/// <summary>
		/// Replacement for <see cref="ShapeField.GetBackgroundBrush"/> that recognizes
		/// <see cref="IDynamicColorGeometryHost"/>
		/// </summary>
		public override Pen GetPen(DiagramClientView view, ShapeElement parentShape, ref Color oldColor)
		{
			StyleSet styleSet = (parentShape != null) ? parentShape.StyleSet : null;
			Color restoreColor = Color.Empty;
			Pen pen = null;
			if (styleSet != null)
			{
				StyleSetResourceId penId = GetPenId(parentShape);
				pen = styleSet.GetPen(penId);
				IDynamicColorGeometryHost dynamicColors = parentShape as IDynamicColorGeometryHost;
				if (dynamicColors == null ||
					(restoreColor = dynamicColors.UpdateDynamicColor(penId, pen)).IsEmpty)
				{
					if (view != null)
					{
						restoreColor = parentShape.UpdateGeometryLuminosity(view, pen);
					}
				}
				else if (view != null)
				{
					parentShape.UpdateGeometryLuminosity(view, pen);
				}
			}
			if (pen != null && !restoreColor.IsEmpty)
			{
				restoreColor = pen.Color;
			}
			return pen;
		}
Ejemplo n.º 4
0
		/// <summary>
		/// Replacement for <see cref="ShapeField.GetBackgroundBrush"/> that recognizes
		/// <see cref="IDynamicColorGeometryHost"/>
		/// </summary>
		public override Brush GetBackgroundBrush(DiagramClientView view, ShapeElement parentShape, ref Color oldColor)
		{
			StyleSet styleSet = (parentShape != null) ? parentShape.StyleSet : null;
			Brush brush = null;
			SolidBrush solidBrush = null;;
			Color restoreColor = Color.Empty;
			if (styleSet != null)
			{
				StyleSetResourceId brushId = GetBackgroundBrushId(view, parentShape);
				brush = styleSet.GetBrush(brushId);
				IDynamicColorGeometryHost dynamicColors = parentShape as IDynamicColorGeometryHost;
				if (dynamicColors == null ||
					(restoreColor = dynamicColors.UpdateDynamicColor(brushId, brush)).IsEmpty)
				{
					if (view != null)
					{
						restoreColor = parentShape.UpdateGeometryLuminosity(view, brush);
					}
				}
				else if (view != null)
				{
					parentShape.UpdateGeometryLuminosity(view, brush);
				}
			}
			if (restoreColor.IsEmpty)
			{
				if ((solidBrush ?? (solidBrush = brush as SolidBrush)) != null)
				{
					restoreColor = solidBrush.Color;
				}
			}
			if (!restoreColor.IsEmpty)
			{
				oldColor = restoreColor;
			}
			return brush;
		}