private void cmbSymbolType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbSymbolType.SelectedItem.ToString() == "Simple")
            {
                if (tabSymbolProperties.TabPages.Contains(tabPicture))
                {
                    tabSymbolProperties.TabPages.Remove(tabPicture);
                }
                if (tabSymbolProperties.TabPages.Contains(tabCharacter))
                {
                    tabSymbolProperties.TabPages.Remove(tabCharacter);
                }
                if (tabSymbolProperties.TabPages.Contains(tabSimple) == false)
                {
                    tabSymbolProperties.TabPages.Insert(0, tabSimple);
                    tabSymbolProperties.SelectedTab = tabSimple;
                }
            }
            if (cmbSymbolType.SelectedItem.ToString() == "Character")
            {
                if (tabSymbolProperties.TabPages.Contains(tabPicture))
                {
                    tabSymbolProperties.TabPages.Remove(tabPicture);
                }
                if (tabSymbolProperties.TabPages.Contains(tabSimple))
                {
                    tabSymbolProperties.TabPages.Remove(tabSimple);
                }
                if (tabSymbolProperties.TabPages.Contains(tabCharacter) == false)
                {
                    tabSymbolProperties.TabPages.Insert(0, tabCharacter);
                    tabSymbolProperties.SelectedTab = tabCharacter;
                }
            }
            if (cmbSymbolType.SelectedItem.ToString() == "Picture")
            {
                if (tabSymbolProperties.TabPages.Contains(tabSimple))
                {
                    tabSymbolProperties.TabPages.Remove(tabSimple);
                }
                if (tabSymbolProperties.TabPages.Contains(tabCharacter))
                {
                    tabSymbolProperties.TabPages.Remove(tabCharacter);
                }
                if (tabSymbolProperties.TabPages.Contains(tabPicture) == false)
                {
                    tabSymbolProperties.TabPages.Insert(0, tabPicture);
                    tabSymbolProperties.SelectedTab = tabPicture;
                }
            }

            if (_ignoreChanges) return;

            int index = ccSymbols.Symbols.IndexOf(ccSymbols.SelectedSymbol);
            if (index == -1) return;
            ISymbol oldSymbol = ccSymbols.SelectedSymbol;

            if (cmbSymbolType.SelectedItem.ToString() == "Simple")
            {
                SimpleSymbol ss = new SimpleSymbol();
                if (oldSymbol != null) ss.CopyPlacement(oldSymbol);
                ccSymbols.Symbols[index] = ss;
                ccSymbols.RefreshList();
                ccSymbols.SelectedSymbol = ss;
            }
            if (cmbSymbolType.SelectedItem.ToString() == "Character")
            {
                CharacterSymbol cs = new CharacterSymbol();
                if (oldSymbol != null) cs.CopyPlacement(oldSymbol);
                ccSymbols.Symbols[index] = cs;
                ccSymbols.RefreshList();
                ccSymbols.SelectedSymbol = cs;
            }
            if (cmbSymbolType.SelectedItem.ToString() == "Picture")
            {
                PictureSymbol ps = new PictureSymbol();
                if (oldSymbol != null) ps.CopyPlacement(oldSymbol);
                ccSymbols.Symbols[index] = ps;
                ccSymbols.RefreshList();
                ccSymbols.SelectedSymbol = ps;
            }
        }
Exemplo n.º 2
0
        private void CmbSymbolTypeSelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbSymbolType.SelectedItem.ToString() == "Simple")
            {
                if (tabSymbolProperties.TabPages.Contains(tabPicture))
                {
                    tabSymbolProperties.TabPages.Remove(tabPicture);
                }

                if (tabSymbolProperties.TabPages.Contains(tabCharacter))
                {
                    tabSymbolProperties.TabPages.Remove(tabCharacter);
                }

                if (tabSymbolProperties.TabPages.Contains(tabSimple) == false)
                {
                    tabSymbolProperties.TabPages.Insert(0, tabSimple);
                    tabSymbolProperties.SelectedTab = tabSimple;
                }
            }

            if (cmbSymbolType.SelectedItem.ToString() == "Character")
            {
                if (tabSymbolProperties.TabPages.Contains(tabPicture))
                {
                    tabSymbolProperties.TabPages.Remove(tabPicture);
                }

                if (tabSymbolProperties.TabPages.Contains(tabSimple))
                {
                    tabSymbolProperties.TabPages.Remove(tabSimple);
                }

                if (tabSymbolProperties.TabPages.Contains(tabCharacter) == false)
                {
                    tabSymbolProperties.TabPages.Insert(0, tabCharacter);
                    tabSymbolProperties.SelectedTab = tabCharacter;
                }
            }

            if (cmbSymbolType.SelectedItem.ToString() == "Picture")
            {
                if (tabSymbolProperties.TabPages.Contains(tabSimple))
                {
                    tabSymbolProperties.TabPages.Remove(tabSimple);
                }

                if (tabSymbolProperties.TabPages.Contains(tabCharacter))
                {
                    tabSymbolProperties.TabPages.Remove(tabCharacter);
                }

                if (tabSymbolProperties.TabPages.Contains(tabPicture) == false)
                {
                    tabSymbolProperties.TabPages.Insert(0, tabPicture);
                    tabSymbolProperties.SelectedTab = tabPicture;
                }
            }

            if (_ignoreChanges)
            {
                return;
            }

            int index = ccSymbols.Symbols.IndexOf(ccSymbols.SelectedSymbol);

            if (index == -1)
            {
                return;
            }
            ISymbol oldSymbol = ccSymbols.SelectedSymbol;

            if (cmbSymbolType.SelectedItem.ToString() == "Simple")
            {
                SimpleSymbol ss = new SimpleSymbol();
                if (oldSymbol != null)
                {
                    ss.CopyPlacement(oldSymbol);
                }
                ccSymbols.Symbols[index] = ss;
                ccSymbols.RefreshList();
                ccSymbols.SelectedSymbol = ss;
            }

            if (cmbSymbolType.SelectedItem.ToString() == "Character")
            {
                CharacterSymbol cs = new CharacterSymbol();
                if (oldSymbol != null)
                {
                    cs.CopyPlacement(oldSymbol);
                }
                ccSymbols.Symbols[index] = cs;
                ccSymbols.RefreshList();
                ccSymbols.SelectedSymbol = cs;
            }

            if (cmbSymbolType.SelectedItem.ToString() == "Picture")
            {
                PictureSymbol ps = new PictureSymbol();
                if (oldSymbol != null)
                {
                    ps.CopyPlacement(oldSymbol);
                }
                ccSymbols.Symbols[index] = ps;
                ccSymbols.RefreshList();
                ccSymbols.SelectedSymbol = ps;
            }
        }
Exemplo n.º 3
0
        private void CmbSymbolTypeSelectedIndexChanged(object sender, EventArgs e)
        {
            SymbolType newSymbolType = Global.ParseEnum <SymbolType>(cmbSymbolType.SelectedIndex);
            ISymbol    oldSymbol     = ccSymbols.SelectedSymbol;

            switch (newSymbolType)
            {
            case SymbolType.Simple:
                if (tabSymbolProperties.TabPages.Contains(tabPicture))
                {
                    tabSymbolProperties.TabPages.Remove(tabPicture);
                }

                if (tabSymbolProperties.TabPages.Contains(tabCharacter))
                {
                    tabSymbolProperties.TabPages.Remove(tabCharacter);
                }

                if (tabSymbolProperties.TabPages.Contains(tabSimple) == false)
                {
                    tabSymbolProperties.TabPages.Insert(0, tabSimple);
                    tabSymbolProperties.SelectedTab = tabSimple;
                }
                break;

            case SymbolType.Character:
                if (tabSymbolProperties.TabPages.Contains(tabPicture))
                {
                    tabSymbolProperties.TabPages.Remove(tabPicture);
                }

                if (tabSymbolProperties.TabPages.Contains(tabSimple))
                {
                    tabSymbolProperties.TabPages.Remove(tabSimple);
                }

                if (tabSymbolProperties.TabPages.Contains(tabCharacter) == false)
                {
                    tabSymbolProperties.TabPages.Insert(0, tabCharacter);
                    tabSymbolProperties.SelectedTab = tabCharacter;
                }
                break;

            case SymbolType.Picture:
                if (tabSymbolProperties.TabPages.Contains(tabSimple))
                {
                    tabSymbolProperties.TabPages.Remove(tabSimple);
                }

                if (tabSymbolProperties.TabPages.Contains(tabCharacter))
                {
                    tabSymbolProperties.TabPages.Remove(tabCharacter);
                }

                if (tabSymbolProperties.TabPages.Contains(tabPicture) == false)
                {
                    tabSymbolProperties.TabPages.Insert(0, tabPicture);
                    tabSymbolProperties.SelectedTab = tabPicture;
                }
                break;

            case SymbolType.Custom:
                MessageBox.Show("暂未实现");
                if (oldSymbol != null)
                {
                    SymbolType oldSymbolType = oldSymbol.SymbolType;
                    cmbSymbolType.SelectedIndex = Global.GetEnumIndex(oldSymbolType);
                }
                return;
            }

            if (_ignoreChanges)
            {
                return;
            }

            int index = ccSymbols.Symbols.IndexOf(ccSymbols.SelectedSymbol);

            if (index == -1)
            {
                return;
            }
            ISymbol newSymbol = null;

            switch (newSymbolType)
            {
            case SymbolType.Simple:
                SimpleSymbol ss = new SimpleSymbol();
                if (oldSymbol != null)
                {
                    ss.CopyPlacement(oldSymbol);
                }
                ccSymbols.Symbols[index] = ss;
                ccSymbols.RefreshList();
                ccSymbols.SelectedSymbol = ss;
                newSymbol = ss;
                break;

            case SymbolType.Character:
                CharacterSymbol cs = new CharacterSymbol();
                if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.DetailedPointSymbolControlFontFamilyName))
                {
                    cs.FontFamilyName = Properties.Settings.Default.DetailedPointSymbolControlFontFamilyName;
                }
                if (oldSymbol != null)
                {
                    cs.CopyPlacement(oldSymbol);
                }
                ccSymbols.Symbols[index] = cs;
                ccSymbols.RefreshList();
                ccSymbols.SelectedSymbol = cs;
                newSymbol = cs;
                break;

            case SymbolType.Picture:
                PictureSymbol ps = new PictureSymbol();
                if (oldSymbol != null)
                {
                    ps.CopyPlacement(oldSymbol);
                }
                ccSymbols.Symbols[index] = ps;
                ccSymbols.RefreshList();
                ccSymbols.SelectedSymbol = ps;
                newSymbol = ps;
                break;

            case SymbolType.Custom:
                break;
            }
            //if (newSymbol != null)
            //{
            //    newSymbol.SetColor(oldSymbol.GetColor());
            //}
        }