2012-01-19 42 views
0

我在VSTO中有一个Powerpoint AddIn,可以执行一些操作,例如从模板中导入幻灯片。Force Powerpoint主窗口更新

为了方便用户,我打开使用WithWindow = MsoTriState.msoFalse

幻灯片插入后,幻灯片窗格不刷新的模板。

我已经试过萨姆WinAPI的呼吁像RedrawWindow但它不工作

我怎么能迫使整个PowerPoint的窗口刷新?

回答

0

调用表示对象的NewWindow方法。这里有一个VBA例如:

Sub ShowYourStuff() 

    Dim oPres As Presentation 
    Set oPres = Presentations.Add(msoFalse) 
    oPres.Slides.Add 1, ppLayoutChart 
    oPres.Slides.Add 1, ppLayoutFourObjects 

    MsgBox "Ready to show the user stuff?" 

    oPres.NewWindow 

End Sub 
0

我想我已经使用InvalidateRect强制PowerPoint中重新绘制窗口,但记住,如果用一个空矩形使用它有困难。

你可以试试这个

<StructLayout(LayoutKind.Sequential)> _ 
Public Structure RECT 
    Public left As Integer 
    Public top As Integer 
    Public right As Integer 
    Public bottom As Integer 
End Structure 

... 
Dim windowRect As RECT 
GetWindowRect(New IntPtr(Application.HWND), windowRect) 
InvalidateRect(New IntPtr(Application.HWND), New Rectangle(0, 0, windowRect.right - windowRect.left, windowRect.bottom - windowRect.top), True)