VSTO Outlook鼠标指针更改

时间:2018-11-18 06:45:07

标签: c# vsto outlook-addin outlook-object-model

使用Outlook VSTO加载项。我正在尝试更改鼠标指针以反映在后台执行的操作。我测试了以下代码:

Cursor.Current = Cursors.WaitCursor

Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;

Wait Cursor in VSTO word add-in application

Microsoft.Office.Interop.Outlook.Application app = Globals.ThisAddIn.Application;
app.System.Cursor = wdCursorWait; // --> app.System does not exist + No OutlookCursor :-/

有任何线索吗?

2 个答案:

答案 0 :(得分:0)

请尝试以下方法之一解决您的问题,并让我知道结果。

Cursor.Current = Cursors.WaitCursor;

 this.UseWaitCursor = true;

this.Cursor = Cursors.WaitCursor;

Application.UseWaitCursor = true;

Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;

答案 1 :(得分:0)

您需要导入Word.DLL,然后使用以下代码

            Outlook.Inspector currentInspector = Globals.ThisAddIn.Application.ActiveInspector();
            Word.Document document = currentInspector.WordEditor;
            Word.Application wordApp = document.Application;
            wordApp.System.Cursor = Word.WdCursorType.wdCursorWait;
            //perform your task
           //Switch to default Cursor 
           wordApp.System.Cursor = Word.WdCursorType.wdCursorNormal;