コード例 #1
0
        private void paletteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count != 1)
            {
                return;
            }
            uint      fid  = uint.Parse(listView1.SelectedItems[0].SubItems[0].Text);
            String    men  = (sender as ToolStripMenuItem).Text;
            BResource bres = null;

            try
            {
                switch (men)
                {
                case "Palette": bres = new BPalette(fid, ""); break;

                case "Image": bres = new BImage(fid, 320, 200, "", 0); break;

                case "Sequence": bres = new BSequence(fid, "", "aqua"); break;

                case "Sprites": bres = new BSprites(fid, ""); break;

                case "Charset": bres = new BCharset(fid, 8, 0); break;

                case "Text": bres = new BText(fid); break;

                case "Script": bres = new BScripts(fid); break;

                case "Speech": bres = new BSpeech(fid); break;

                case "Sound": bres = new BSound(fid); break;
                }
            }
            catch (Exception ex)
            {
                bres = null;
                MessageBox.Show("Error creating resource.\n" + ex.GetType().Name + ":\n" + ex.Message);
            }
            if (bres != null)
            {
                clearRes();
                cntrl = bres.control;
                if (cntrl != null)
                {
                    panel1.Controls.Add(cntrl);
                    bres.initControl();
                }
            }
        }
コード例 #2
0
 private void paletteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count!=1) return;
     uint fid = uint.Parse(listView1.SelectedItems[0].SubItems[0].Text);
     String men = (sender as ToolStripMenuItem).Text;
     BResource bres = null;
     try
     {
         switch (men)
         {
             case "Palette": bres = new BPalette(fid, ""); break;
             case "Image": bres = new BImage(fid, 320, 200, "",0); break;
             case "Sequence": bres = new BSequence(fid, "", "aqua"); break;
             case "Sprites": bres = new BSprites(fid, ""); break;
             case "Charset": bres = new BCharset(fid, 8, 0); break;
             case "Text": bres = new BText(fid); break;
             case "Script": bres = new BScripts(fid); break;
             case "Speech": bres = new BSpeech(fid); break;
             case "Sound": bres = new BSound(fid); break;
         }
     }
     catch(Exception ex)
     {
         bres = null;
         MessageBox.Show("Error creating resource.\n"+ex.GetType().Name+":\n"+ex.Message);
     }
     if (bres != null)
     {
         clearRes();
         cntrl = bres.control;
         if (cntrl!=null)
         {
             panel1.Controls.Add(cntrl);
             bres.initControl();
         }
     }
 }