Exemplo n.º 1
0
            /// <summary>
            /// Initialize paint settings. This is initialized after the base shape
            /// has been painted.
            /// </summary>
            public PaintHelper(DiagramPaintEventArgs e, ExternalConstraintShape constraintShape)
            {
                StyleSet           styleSet = constraintShape.StyleSet;
                StyleSetResourceId penId    = constraintShape.OutlinePenId;
                Pen        pen          = styleSet.GetPen(penId);
                Brush      brush        = styleSet.GetBrush(ExternalConstraintBrush);
                SolidBrush coloredBrush = brush as SolidBrush;

                // Keep the pen color in sync with the color being used for highlighting
                Color startColor = constraintShape.UpdateDynamicColor(constraintShape.OutlinePenId, pen);

                if (startColor.IsEmpty)
                {
                    startColor = constraintShape.UpdateGeometryLuminosity(e.View, pen);
                }
                else
                {
                    constraintShape.UpdateGeometryLuminosity(e.View, pen);
                }
                myPenStartColor = startColor;
                Color newColor = pen.Color;

                if (coloredBrush != null)
                {
                    myBrushStartColor  = coloredBrush.Color;
                    coloredBrush.Color = newColor;
                }
                else
                {
                    myBrushStartColor = Color.Empty;
                }
                myBrush = brush;
                myPen   = pen;
            }
Exemplo n.º 2
0
			/// <summary>
			/// Initialize paint settings. This is initialized after the base shape
			/// has been painted.
			/// </summary>
			public PaintHelper(DiagramPaintEventArgs e, ExternalConstraintShape constraintShape)
			{
				StyleSet styleSet = constraintShape.StyleSet;
				StyleSetResourceId penId = constraintShape.OutlinePenId;
				Pen pen = styleSet.GetPen(penId);
				Brush brush = styleSet.GetBrush(ExternalConstraintBrush);
				SolidBrush coloredBrush = brush as SolidBrush;

				// Keep the pen color in sync with the color being used for highlighting
				Color startColor = constraintShape.UpdateDynamicColor(constraintShape.OutlinePenId, pen);
				if (startColor.IsEmpty)
				{
					startColor = constraintShape.UpdateGeometryLuminosity(e.View, pen);
				}
				else
				{
					constraintShape.UpdateGeometryLuminosity(e.View, pen);
				}
				myPenStartColor = startColor;
				Color newColor = pen.Color;
				if (coloredBrush != null)
				{
					myBrushStartColor = coloredBrush.Color;
					coloredBrush.Color = newColor;
				}
				else
				{
					myBrushStartColor = Color.Empty;
				}
				myBrush = brush;
				myPen = pen;
			}