private void SymbolForm_Load(object sender, EventArgs e) { // 加载函数管理控件页面 FunctionForm funform = new FunctionForm("管理函数"); funform.TopLevel = false; funform.Location = new Point(165, 0); funform.Size = new System.Drawing.Size(500, 500); funform.Anchor = AnchorStyles.Top | AnchorStyles.Left; funform.FormBorderStyle = FormBorderStyle.None; funform.Show(); funform.Name = "FunForm"; funform.setMainFormPointer((MainForm)this.Owner, this); this.tabControl1.TabPages[0].Controls.Add(funform); // 加载函数清单 List <string> funList = core.getAllFunction(); foreach (string s in funList) { this.funListBox.Items.Add(s); } this.funListBox.SelectedIndex = 0; // 加载全局变量 List <string> globalVector = core.getGlobalVar(); this.globalvarDataGridView.Rows.Clear(); for (int i = 0; i < globalVector.Count; i++) { this.globalvarDataGridView.Rows.Add(); string[] splitItem = globalVector[i].Split('@'); this.globalvarDataGridView.Rows[i].Cells[0].Value = splitItem[0]; this.globalvarDataGridView.Rows[i].Cells[1].Value = splitItem[1]; } // 加载开关列表 for (int i = 0; i < Consta.switch_max; i++) { this.switchDataGridView.Rows.Add(); this.switchDataGridView.Rows[i].Cells[0].Value = i; this.switchDataGridView.Rows[i].Cells[1].Value = core.getSwitchDescriptionVector()[i]; } }
// 添加按钮 private void button18_Click(object sender, EventArgs e) { FunctionForm addFunForm = new FunctionForm("从管理器新建函数"); addFunForm.ShowDialog(this); }
private void SymbolForm_Load(object sender, EventArgs e) { // 加载函数管理控件页面 FunctionForm funform = new FunctionForm("管理函数"); funform.TopLevel = false; funform.Location = new Point(165, 0); funform.Size = new System.Drawing.Size(500, 500); funform.Anchor = AnchorStyles.Top | AnchorStyles.Left; funform.FormBorderStyle = FormBorderStyle.None; funform.Show(); funform.Name = "FunForm"; funform.setMainFormPointer((MainForm)this.Owner, this); this.tabControl1.TabPages[0].Controls.Add(funform); // 加载函数清单 List<string> funList = core.getAllFunction(); foreach (string s in funList) { this.funListBox.Items.Add(s); } this.funListBox.SelectedIndex = 0; // 加载全局变量 List<string> globalVector = core.getGlobalVar(); this.globalvarDataGridView.Rows.Clear(); for (int i = 0; i < globalVector.Count; i++) { this.globalvarDataGridView.Rows.Add(); string[] splitItem = globalVector[i].Split('@'); this.globalvarDataGridView.Rows[i].Cells[0].Value = splitItem[0]; this.globalvarDataGridView.Rows[i].Cells[1].Value = splitItem[1]; } // 加载开关列表 for (int i = 0; i < Consta.switch_max; i++) { this.switchDataGridView.Rows.Add(); this.switchDataGridView.Rows[i].Cells[0].Value = i; this.switchDataGridView.Rows[i].Cells[1].Value = core.getSwitchDescriptionVector()[i]; } }
// 双击函数列表时 private void functionListBox_MouseDoubleClick(object sender, MouseEventArgs e) { // 获取选中的项目 int index = this.functionListBox.IndexFromPoint(e.Location); if (index != System.Windows.Forms.ListBox.NoMatches) { string fcname = (string)this.functionListBox.Items[index]; // main函数不可编辑 if (fcname == "main") { MessageBox.Show("主函数main的函数签名不可编辑", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } FunctionForm addFunForm = new FunctionForm("编辑函数", fcname); addFunForm.ShowDialog(this); } }