微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

为什么更改VSTO中单词添加时功能区中的File2状态​​和File1也会更改

如何解决为什么更改VSTO中单词添加时功能区中的File2状态​​和File1也会更改

我已经在我的Word加载项功能区中创建了两个按钮:状态按钮和认的“打开”按钮和 ChangeStatus 按钮。

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

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

image 1

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
    }
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。