Beispiel #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (TAG == "xll")
     {
         string s = listBox1.SelectedItem.ToString();
         Console.WriteLine(s);
         MyExcelFunctions.RemoveXllMacro(s);
     }
     else if (TAG == "com1" || TAG == "com2")
     {
         string            s   = listBox1.SelectedItem.ToString();
         Excel.Application app = ExcelDnaUtil.Application as Excel.Application;
         dynamic           list;
         if (TAG == "com1")
         {
             list = app.AddIns;
         }
         else
         {
             list = app.AddIns2;
         }
         foreach (dynamic j in list)
         {
             if (j.FullName == s)
             {
                 File.Delete(j.FullName);
             }
         }
     }
     LoadList();
 }
Beispiel #2
0
        public void button_Click(IRibbonControl control)
        {
            switch (control.Id)
            {
            case "GetMaxLineButton":
                MessageBox.Show("当前文档最大行数 " + MyExcelFunctions.GetMaxLineMacro());
                break;

            case "fivechess":
                MainForm main = new MainForm();
                main.Show(); break;

            case "btn_xll":
                ShowAddInForm("xll");
                break;

            case "btn_com1":
                ShowAddInForm("com1");
                break;

            case "btn_com2":
                ShowAddInForm("com2");
                break;

            case "dyecolor":
                if (dyeForm == null || dyeForm.IsDisposed)
                {
                    dyeForm = new DyeCellForm();
                }
                dyeForm.Show();
                dyeForm.Focus();
                break;

            case "markSame":
                MarkSame(); break;

            case "FillEmpty":
                FillEmpty(); break;

            case "Calculator":
                if (clcForm == null || clcForm.IsDisposed || clcForm.IsRichBoxDisposed())
                {
                    clcForm = new CalculatorForm();
                }
                clcForm.Show();
                clcForm.Focus();
                clcForm.Activate();
                clcForm.WindowState = FormWindowState.Normal;
                break;

            case "DrawPlatoGraph":
                ShowPlato(); break;

            case "ShowDanmu":
                ShowDanmu(); break;

            case "Settings":
                if (settingForm == null || settingForm.IsDisposed)
                {
                    settingForm = new SettingForm();
                }
                settingForm.Show();
                settingForm.Focus();

                break;

            default:
                MessageBox.Show("Hello:" + control.Id);
                break;
            }
        }