我有一个小文本编辑器,允许通过菜单栏插入表格。
当我的表单加载时,我的菜单中唯一启用的内容是"插入表"。一旦我点击插入表,所有其他菜单项现在都已启用。
我正在尝试做什么,而且当我从编辑器中删除表格时,我想重新禁用表格放在编辑器中时启用的项目。
我到目前为止的代码是:
private void Form1_Load(object sender, EventArgs e)
{
RMIInsertRow.Enabled = false;
RMIInsertCol.Enabled = false;
RMIMergeCells.Enabled = false;
RMISplitCellHoriz.Enabled = false;
RMIDeleteCells.Enabled = false;
RMIRowPos.Enabled = false;
RMIRowHeight.Enabled = false;
RMIHeaderRow.Enabled = false;
RMIKeepRowTogether.Enabled = false;
RMIRowTextFlow.Enabled = false;
RMICellWidth.Enabled = false;
RMICellBorderWidth.Enabled = false;
RMICellBorderColor.Enabled = false;
RMICellShading.Enabled = false;
RMICellColor.Enabled = false;
RMICellVertAlign.Enabled = false;
RMICellRotateText.Enabled = false;
RMISelectCurCol.Enabled = false;
}
private void RMIInsertTable_Click(object sender, EventArgs e)
{
t.TestCommand(test.TABLE_INSERT);
if (sender == RMIInsertTable)
{
RMIInsertRow.Enabled = true;
RMIInsertCol.Enabled = true;
RMIMergeCells.Enabled = true;
RMISplitCellHoriz.Enabled = true;
RMIDeleteCells.Enabled = true;
RMIRowPos.Enabled = true;
RMIRowHeight.Enabled = true;
RMIHeaderRow.Enabled = true;
RMIKeepRowTogether.Enabled = true;
RMIRowTextFlow.Enabled = true;
RMICellWidth.Enabled = true;
RMICellBorderWidth.Enabled = true;
RMICellBorderColor.Enabled = true;
RMICellShading.Enabled = true;
RMICellColor.Enabled = true;
RMICellVertAlign.Enabled = true;
RMICellRotateText.Enabled = true;
RMISelectCurCol.Enabled = true;
}
}