如何在Outlook任务窗格VSTO中显示标签

时间:2018-05-15 05:10:43

标签: c# outlook vsto outlook-addin

我正在开发像Grammerly这样的 Outlook插件,我添加了一个用于检查拼写的功能区按钮和用于显示错误的任务窗格。我使用了 NHunspell 插件来检查拼写错误。 问题是,当我单击检查按钮时,它将成功找到错误,但错误无法在任务窗格中显示。

这就是我在 InspecterWrapper类

中添加taskpane的方法
public Microsoft.Office.Tools.CustomTaskPane myCustomtask;
objsidepane = new SidePane();
myCustomtask = this.CustomTaskPanes.Add(objsidepane, "Taskpane");

这是CheckButton点击功能。

private void btnCheck_Click(object sender, RibbonControlEventArgs e)
    {
       Display("checked");
    }

在侧窗我有这个功能,我在tskpane中有一个标签

public void Display(String s)
    {
        Label1.Text=s;
    }

实际上价值已经到了这里,但它没有改变标签。

1 个答案:

答案 0 :(得分:0)

您似乎需要将任务窗格类的Visible属性设置为true

 public Microsoft.Office.Tools.CustomTaskPane myCustomtask;
 objsidepane = new SidePane();
 myCustomtask = this.CustomTaskPanes.Add(objsidepane, "Taskpane");
 myCustomtask.Visible = true;

有关详细信息,请参阅How to: Add a Custom Task Pane to an Application

您还可以通过在Display方法中设置Visible属性来动态显示任务窗格:

public void Display(String s)
{
    myCustomtask.Visible = true;
    Label1.Text=s;
}

详细了解相关内容 Walkthrough: Synchronizing a Custom Task Pane with a Ribbon Button