Ejemplo n.º 1
0
        private void useNewProperty(PropertyCollector newPro)
        {
            comingBackFromShape = true;

            bool isnull = (proCollector == null);

            // anti-alias
            if (isnull || proCollector.Antialias != newPro.Antialias)
            {
                ts_Antialias.Image = newPro.Antialias ?
                                     Properties.Resources.anti_true : Properties.Resources.anti_false;
            }

            // indicator arrow size
            if (isnull || proCollector.IndicatorLineSize != newPro.IndicatorLineSize)
            {
                switch (newPro.IndicatorLineSize)
                {
                case IndicatorSize.Small:
                    ts_cm_indicator_size.SelectedIndex = 0;
                    break;

                case IndicatorSize.Medium:
                    ts_cm_indicator_size.SelectedIndex = 1;
                    break;

                case IndicatorSize.Large:
                    ts_cm_indicator_size.SelectedIndex = 2;
                    break;
                }
            }

            // stroke color
            if (isnull || proCollector.StrokeColor != newPro.StrokeColor)
            {
                MainColor.StrokeColor = newPro.StrokeColor;
            }

            // stroke width
            if (isnull || proCollector.PenWidth != newPro.PenWidth)
            {
                ts_StrokeWidth.Text = newPro.PenWidth.ToString();
            }

            // line start cap
            if (isnull || proCollector.StartLineCap != newPro.StartLineCap)
            {
                Bitmap bm = null;
                switch (newPro.StartLineCap)
                {
                case LineCapType.Rounded:
                    bm = Properties.Resources.cap_round_left;
                    break;

                case LineCapType.Square:
                    bm = Properties.Resources.cap_square_left;
                    break;

                case LineCapType.Rectangle:
                    bm = Properties.Resources.cap_rect_left;
                    break;

                case LineCapType.Circle:
                    bm = Properties.Resources.cap_circle_left;
                    break;

                case LineCapType.LineArrow:
                    bm = Properties.Resources.line_arrow_left;
                    break;

                case LineCapType.SharpArrow:
                    bm = Properties.Resources.sharp_arrow_left;
                    break;

                case LineCapType.SharpArrow2:
                    bm = Properties.Resources.sharp_arrow2_left;
                    break;

                case LineCapType.NormalArrow:
                    bm = Properties.Resources.normal_arrow_left;
                    break;
                }
                tsbtn_StartCap.Image = bm;
            }

            // line end cap
            if (isnull || proCollector.EndLineCap != newPro.EndLineCap)
            {
                Bitmap bm = null;
                switch (newPro.EndLineCap)
                {
                case LineCapType.Rounded:
                    bm = Properties.Resources.cap_round_right;
                    break;

                case LineCapType.Square:
                    bm = Properties.Resources.cap_square_right;
                    break;

                case LineCapType.Rectangle:
                    bm = Properties.Resources.cap_rect_right;
                    break;

                case LineCapType.Circle:
                    bm = Properties.Resources.cap_circle_right;
                    break;

                case LineCapType.LineArrow:
                    bm = Properties.Resources.line_arrow_right;
                    break;

                case LineCapType.SharpArrow:
                    bm = Properties.Resources.sharp_arrow_right;
                    break;

                case LineCapType.SharpArrow2:
                    bm = Properties.Resources.sharp_arrow2_right;
                    break;

                case LineCapType.NormalArrow:
                    bm = Properties.Resources.normal_arrow_right;
                    break;
                }
                ts_endcap.Image = bm;
            }

            // line dash type
            if (isnull || proCollector.LineDash != newPro.LineDash)
            {
                Bitmap bm = null;
                switch (newPro.LineDash)
                {
                case LineDashType.Solid:
                    bm = Properties.Resources.solid;
                    break;

                case LineDashType.Dot:
                    bm = Properties.Resources.dot;
                    break;

                case LineDashType.DashedDot:
                    bm = Properties.Resources.dash_dot;
                    break;

                case LineDashType.DashedDotDot:
                    bm = Properties.Resources.dash_dot_dot;
                    break;

                case LineDashType.Dash1:
                    bm = Properties.Resources.dash;
                    break;

                case LineDashType.Dash2:
                    bm = Properties.Resources.dash2;
                    break;
                }
                ts_line_dash.Image = bm;
            }

            // paint type
            if (isnull || proCollector.PaintType != newPro.PaintType)
            {
                switch (newPro.PaintType)
                {
                case ShapePaintType.Stroke:
                    ts_cm_PaintType.SelectedIndex = 0;
                    break;

                case ShapePaintType.Fill:
                    ts_cm_PaintType.SelectedIndex = 1;
                    break;

                case ShapePaintType.StrokeAndFill:
                    ts_cm_PaintType.SelectedIndex = 2;
                    break;
                }
            }

            // fill color
            if (isnull || proCollector.FillColor != newPro.FillColor)
            {
                MainColor.FillColor = newPro.FillColor;
            }

            // round radius
            if (isnull || proCollector.RadiusAll != newPro.RadiusAll)
            {
                ts_cm_round_radius.Text = newPro.RadiusAll.ToString();
            }

            proCollector        = newPro;
            comingBackFromShape = false;
        }