简体   繁体   English

如何在 VSTO 的 Excel 状态栏中显示“更新工作流状态”进度条?

[英]How to display "Updating Workflow Status" progress bar in Excel status bar in VSTO?

I need a indicator in Excel VSTO to let user know the background task is running, and I'd like to use Excel native progressbar like this:我需要 Excel VSTO 中的指示器让用户知道后台任务正在运行,我想使用 Excel 原生进度条,如下所示:

在此处输入图像描述

Does anyone know how to show and hide this in VSTO?有谁知道如何在 VSTO 中显示和隐藏它? Thank you.谢谢你。

There is no trivial way to customize the status bar with a progress bar...没有简单的方法可以使用进度条自定义状态栏...

The Application.StatusBar property allows setting a custom text in the status bar, but not a progress bar. Application.StatusBar属性允许在状态栏中设置自定义文本,但不能在进度栏中设置。 This property returns false if Microsoft Excel has control of the status bar.如果 Microsoft Excel 控制了状态栏,则此属性返回false To restore the default status bar text, set the property to false - this works even if the status bar is hidden.要恢复默认状态栏文本,请将属性设置为false - 即使隐藏状态栏也可以使用。

oldStatusBar = Application.DisplayStatusBar 
Application.DisplayStatusBar = True 
Application.StatusBar = "Please be patient..." 
Workbooks.Open filename:="LARGE.XLS" 
Application.StatusBar = False 
Application.DisplayStatusBar = oldStatusBar

If you want to display a progress bar with some text I'd suggest using task panes for that.如果您想显示带有一些文本的进度条,我建议您使用任务窗格。 Read more about that in the How to: Add a custom task pane to an application article.如何:将自定义任务窗格添加到应用程序一文中了解更多信息。 On the user control you are free to use any .net controls.在用户控件上,您可以自由使用任何 .net 控件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM