示例#1
0
            /// <summary>Writes the styles from this object into the normal (non-highlight) styles in the shape</summary>
            public void ApplyToShape(Shape shape)
            {
                FillStyleC fill = (FillStyleC)shape.StyleObjectForParameter(Parameters.FillColour);

                if (fill != null)
                {
                    fill.Colour = FillColour;
                }
                LineStyleC line = (LineStyleC)shape.StyleObjectForParameter(Parameters.LineColour);

                if (line != null)
                {
                    line.Colour = LineColour;
                    line.Width  = LineWidth * 2 - 1;
                }
                TextStyleC text = (TextStyleC)shape.StyleObjectForParameter(Parameters.TextColour);

                if (text != null)
                {
                    text.Colour = TextColour;
                }
            }
示例#2
0
            /// <summary>Creates an instance initialised with the current (non-highlight) styles stored in a shape</summary>
            public static HighlightStyleC FromShape(Shape shape)
            {
                var        highlight = new HighlightStyleC();
                FillStyleC fill      = (FillStyleC)shape.StyleObjectForParameter(Parameters.FillColour);

                if (fill != null)
                {
                    highlight.FillColour = fill.Colour;
                }
                LineStyleC line = (LineStyleC)shape.StyleObjectForParameter(Parameters.LineColour);

                if (line != null)
                {
                    highlight.LineColour = line.Colour;
                    highlight.LineWidth  = (line.Width + 1) / 2;
                }
                TextStyleC text = (TextStyleC)shape.StyleObjectForParameter(Parameters.TextColour);

                if (text != null)
                {
                    highlight.TextColour = text.Colour;
                }
                return(highlight);
            }