开发者

In InfoPath, hide custom task pane on open

Is it possible to hide my custom task pane when opening the file. I tried to add the following command to the OnLoad event, but it looks like the View has not yet been created at this point:

thisXDocument.View.Window.TaskPanes[0].Visible = false;

Is there any other开发者_运维知识库 way to do it?

BTW- I am using the 2003 InfoPath API.


It looks like OnSwitchView is called just after the form is completly loaded. So the View object has been created and you can get access to the task pane. OnSwitchView is called whenever the view changes and we only want to hide the task pane on load, so my code looks like this:

private bool HideTaskPane = true;
...
[InfoPathEventHandler(EventType = InfoPathEventType.OnSwitchView)]
public void OnSwitchView(DocEvent e)
{
    //We only want to perform this once, on startup.
    if (HideTaskPane == true)
    {
        thisXDocument.View.Window.TaskPanes[0].Visible = false;
        HideTaskPane = false;
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜