Example #1
0
        private void CcSymbolsAddClicked(object sender, EventArgs e)
        {
            ISymbol    s          = null;
            SymbolType symbolType = Global.ParseEnum <SymbolType>(cmbSymbolType.SelectedIndex);

            switch (symbolType)
            {
            case SymbolType.Simple:
                s = new SimpleSymbol();
                break;

            case SymbolType.Character:
                CharacterSymbol cs         = new CharacterSymbol();
                string          fontFamily = Properties.Settings.Default.DetailedPointSymbolControlFontFamilyName;
                if (!string.IsNullOrWhiteSpace(fontFamily))
                {
                    cs.FontFamilyName = fontFamily;
                }
                s = cs;
                break;

            case SymbolType.Picture:
                s = new PictureSymbol();
                break;

            case SymbolType.Custom:
                MessageBox.Show("暂未实现");
                return;
            }
            if (s != null)
            {
                double width  = Properties.Settings.Default.DetailedPointSymbolControlSymbolWidth;
                double height = Properties.Settings.Default.DetailedPointSymbolControlSymbolHeight;
                if (width <= 0)
                {
                    width = 10;
                }
                if (height <= 0)
                {
                    height = 10;
                }
                s.Size = new Size2D(width, height);
                s.SetColor(ccSymbols.SelectedSymbol.GetColor());
                ccSymbols.Symbols.Add(s);
                UpdatePreview();
            }
        }