2016-08-23 20 views
2

我使用的是功能區按鈕下面的代碼點擊吐MS Word窗口,滾動到一個範圍在Microsoft Word分裂窗

private void RibbonButton_Click(object sender, RibbonControlEventArgs e) { 

Window win = (Window) e.Control.Context; 
win.SplitVertical = 50; 

} 

我需要滾動到特定範圍的每個的拆分視圖。我試着用下面的代碼選擇範圍,

Panes panes = win.Panes; 
foreach(Pane pane in panes){          
    Range r = pane.Document.Range(400, 405); // Sample range for testing       
    r.Select(); 
} 

但這個代碼只滾動到的底部視圖的範圍內,但它不會滾動俯視圖。

對此的任何想法?

回答

0

您只需激活窗格如下,

Panes panes = win.Panes; 
    foreach(Pane pane in panes){ 
     pane.Activate(); // Activate the Pane         
     Range r = pane.Document.Range(400, 405); // Sample range for testing       
     r.Select(); 
    }