C# 为什么更改file2状态,file1在word加载项VSTO的功能区中也会更改

C# 为什么更改file2状态,file1在word加载项VSTO的功能区中也会更改,c#,vsto,ribbon,word-addins,customtaskpane,C#,Vsto,Ribbon,Word Addins,Customtaskpane,我在Word加载项功能区中创建了两个按钮:状态默认为“打开”的按钮和更改状态按钮 我打开两个文件进行测试。我单击更改状态按钮file2关闭,file1也更改为关闭 当我单击文件2上的更改状态按钮时,如何强制文件1显示打开未关闭。(仅状态按钮文件2更改为“关闭”) Demo.cs: using System.Windows.Forms; using Microsoft.Office.Tools.Ribbon; using Office = Microsoft.Office.Core; names

我在Word加载项功能区中创建了两个按钮:状态默认为“打开”的按钮和更改状态按钮

我打开两个文件进行测试。我单击更改状态按钮file2关闭,file1也更改为关闭

当我单击文件2上的更改状态按钮时,如何强制文件1显示打开未关闭。(仅状态按钮文件2更改为“关闭”)

Demo.cs:

using System.Windows.Forms;
using Microsoft.Office.Tools.Ribbon;
using Office = Microsoft.Office.Core;
namespace TestWordAddIn
{
    public partial class Demo
    {
        private Responsive responsive;
        private Detail myDetail;
        private Microsoft.Office.Tools.CustomTaskPane myCustomTaskPane;
        private void Demo_Load(object sender, RibbonUIEventArgs e)
        {
            responsive = new Responsive(Screen.PrimaryScreen.Bounds);
            responsive.SetMultiplicationFactor();
        }

        private void btnStatus_Click(object sender, RibbonControlEventArgs e)
        {
            myDetail = new Detail();

            myCustomTaskPane = Globals.ThisAddIn.CustomTaskPanes.Add(myDetail, "Error List");
            myCustomTaskPane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight;
            myCustomTaskPane.Width = responsive.GetMetrics(380);
            myCustomTaskPane.Visible = true;
        }

        private void btnChangeLable_Click(object sender, RibbonControlEventArgs e)
        {
            btnStatus.Label = "Close";
        }
    }
}
此代码为ThisAddIn.css:

namespace TestWordAddIn
{
    public partial class ThisAddIn
    {
    
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
        
        }

        private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
        {
        }

        #region VSTO generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InternalStartup()
        {
            this.Startup += new System.EventHandler(ThisAddIn_Startup);
            this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
        }
    
        #endregion
    }
}
命名空间TestWordAddIn
{
公共部分类ThisAddIn
{
私有void ThisAddIn_启动(对象发送方,System.EventArgs e)
{
}
私有void ThisAddIn_关闭(对象发送方,System.EventArgs e)
{
}
#区域VSTO生成的代码
/// 
///设计器支持所需的方法-不修改
///此方法的内容与代码编辑器一起使用。
/// 
私有void InternalStartup()
{
this.Startup+=new System.EventHandler(ThisAddIn\u启动);
this.Shutdown+=new System.EventHandler(ThisAddIn\u Shutdown);
}
#端区
}
}