示例#1
0
        private void BtnMarkerClick(object sender, EventArgs e)
        {
            IStroke stroke = ccStrokes.SelectedStroke;

            switch (stroke.StrokeStyle)
            {
            case StrokeStyle.Marker:
                IMarkerStroke             markerStroke = stroke as IMarkerStroke;
                DetailedPointSymbolDialog dpd          = new DetailedPointSymbolDialog(markerStroke.Marker);
                dpd.ChangesApplied += (x, y) => { UpdatePreview(); };
                dpd.ShowDialog();
                break;

            default:
                return;
            }
        }
示例#2
0
        /// <summary>
        /// When the stroke is changed, this updates the controls to match it.
        /// </summary>
        private void UpdateStrokeControls()
        {
            _ignoreChanges = true;
            IStroke stroke = ccStrokes.SelectedStroke;

            cmbStrokeType.SelectedIndex = Global.GetEnumIndex(stroke.StrokeStyle);
            switch (stroke.StrokeStyle)
            {
            case StrokeStyle.Cartographic:
                ICartographicStroke cs = ccStrokes.SelectedStroke as ICartographicStroke;
                if (tabStrokeProperties.TabPages.Contains(tabSimple))
                {
                    tabStrokeProperties.TabPages.Remove(tabSimple);
                }
                if (tabStrokeProperties.TabPages.Contains(tabMarker))
                {
                    tabStrokeProperties.TabPages.Remove(tabMarker);
                }

                if (tabStrokeProperties.TabPages.Contains(tabCartographic) == false)
                {
                    tabStrokeProperties.TabPages.Add(tabCartographic);
                }

                if (tabStrokeProperties.TabPages.Contains(tabDash) == false)
                {
                    tabStrokeProperties.TabPages.Add(tabDash);
                }

                if (tabStrokeProperties.TabPages.Contains(tabDecoration) == false)
                {
                    tabStrokeProperties.TabPages.Add(tabDecoration);
                }

                // Cartographic Tab Page
                if (cmbStartCap.Items.Count == 0)
                {
                    LoadLineCaps();
                }

                cmbStartCap.SelectedItem = cs.StartCap;
                cmbEndCap.SelectedItem   = cs.EndCap;
                radLineJoin.Value        = cs.JoinType;
                dblStrokeOffset.Value    = cs.Offset;

                // Template Tab Page
                dashControl1.SetPattern(cs);
                dashControl1.Invalidate();

                // Decoration Tab Page
                ccDecorations.Decorations = cs.Decorations;
                if (cs.Decorations != null && cs.Decorations.Count > 0)
                {
                    ccDecorations.SelectedDecoration = cs.Decorations[0];
                }
                break;

            case StrokeStyle.Simple:
                if (tabStrokeProperties.TabPages.Contains(tabMarker))
                {
                    tabStrokeProperties.TabPages.Remove(tabMarker);
                }
                if (tabStrokeProperties.TabPages.Contains(tabDash))
                {
                    tabStrokeProperties.TabPages.Remove(tabDash);
                }

                if (tabStrokeProperties.TabPages.Contains(tabCartographic))
                {
                    tabStrokeProperties.TabPages.Remove(tabCartographic);
                }

                if (tabStrokeProperties.TabPages.Contains(tabDecoration))
                {
                    tabStrokeProperties.TabPages.Remove(tabDecoration);
                }

                if (tabStrokeProperties.TabPages.Contains(tabSimple) == false)
                {
                    tabStrokeProperties.TabPages.Add(tabSimple);
                }
                break;

            case StrokeStyle.Marker:
                IMarkerStroke ms = ccStrokes.SelectedStroke as IMarkerStroke;
                if (tabStrokeProperties.TabPages.Contains(tabSimple))
                {
                    tabStrokeProperties.TabPages.Remove(tabSimple);
                }
                if (!tabStrokeProperties.TabPages.Contains(tabMarker))
                {
                    tabStrokeProperties.TabPages.Insert(0, tabMarker);
                }

                if (!tabStrokeProperties.TabPages.Contains(tabCartographic))
                {
                    tabStrokeProperties.TabPages.Add(tabCartographic);
                }

                if (!tabStrokeProperties.TabPages.Contains(tabDash))
                {
                    tabStrokeProperties.TabPages.Add(tabDash);
                }

                if (!tabStrokeProperties.TabPages.Contains(tabDecoration))
                {
                    tabStrokeProperties.TabPages.Add(tabDecoration);
                }

                // Cartographic Tab Page
                if (cmbStartCap.Items.Count == 0)
                {
                    LoadLineCaps();
                }

                cmbStartCap.SelectedItem = ms.StartCap;
                cmbEndCap.SelectedItem   = ms.EndCap;
                radLineJoin.Value        = ms.JoinType;
                dblStrokeOffset.Value    = ms.Offset;

                // Template Tab Page
                dashControl1.SetPattern(ms);
                dashControl1.Invalidate();

                // Decoration Tab Page
                ccDecorations.Decorations = ms.Decorations;
                if (ms.Decorations != null && ms.Decorations.Count > 0)
                {
                    ccDecorations.SelectedDecoration = ms.Decorations[0];
                }
                break;
            }

            ISimpleStroke ss = ccStrokes.SelectedStroke as ISimpleStroke;

            if (ss != null)
            {
                // Simple Tab Page
                cbColorSimple.Color                 = ss.Color;
                cbColorCartographic.Color           = ss.Color;
                dblWidthCartographic.Value          = ss.Width;
                dblWidth.Value                      = ss.Width;
                cmbStrokeStyle.SelectedIndex        = (int)ss.DashStyle;
                sldOpacityCartographic.MaximumColor = Color.FromArgb(255, ss.Color.R, ss.Color.G, ss.Color.B);
                sldOpacitySimple.MaximumColor       = Color.FromArgb(255, ss.Color.R, ss.Color.G, ss.Color.B);
                sldOpacitySimple.Value              = ss.Opacity;
                sldOpacityCartographic.Value        = ss.Opacity;
                sldOpacityCartographic.Invalidate();
                sldOpacitySimple.Invalidate();
            }

            _ignoreChanges = false;
        }