Ejemplo n.º 1
0
        // Add new glyph collection
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NewGlyphCollectionForm newCollectionForm = new NewGlyphCollectionForm(glyphDatabases.GetDatabaseNames( ));

            if (newCollectionForm.ShowDialog( ) == DialogResult.OK)
            {
                string name = newCollectionForm.CollectionName;
                int    size = newCollectionForm.GlyphSize;

                GlyphDatabase db = new GlyphDatabase(size);

                try
                {
                    glyphDatabases.AddGlyphDatabase(name, db);

                    // add new item to list view
                    ListViewItem lvi = glyphCollectionsList.Items.Add(name);
                    lvi.SubItems.Add(string.Format("{0}x{1}", size, size));
                    lvi.Name = name;
                }
                catch
                {
                    ShowErrorBox(string.Format("A glyph database with the name '{0}' already exists.", name));
                }
            }
        }
Ejemplo n.º 2
0
        // Add new glyph collection
        private void newToolStripMenuItem_Click( object sender, EventArgs e )
        {
            NewGlyphCollectionForm newCollectionForm = new NewGlyphCollectionForm( glyphDatabases.GetDatabaseNames( ) );

            if ( newCollectionForm.ShowDialog( ) == DialogResult.OK )
            {
                string name = newCollectionForm.CollectionName;
                int size = newCollectionForm.GlyphSize;

                GlyphDatabase db = new GlyphDatabase( size );

                try
                {
                    glyphDatabases.AddGlyphDatabase( name, db );

                    // add new item to list view
                    ListViewItem lvi = glyphCollectionsList.Items.Add( name );
                    lvi.SubItems.Add( string.Format( "{0}x{1}", size, size ) );
                    lvi.Name = name;
                }
                catch
                {
                    ShowErrorBox( string.Format( "A glyph database with the name '{0}' already exists.", name ) );
                }
            }
        }