2009-05-21 4 views
2

Excel 2003 ActionsPane에서 WPF 차트를 호스팅하고 있습니다. 차트는 수평 및 수직으로 모두 확장되도록 설정되어 있지만 ElementHost 및 차트가 ActionsPane을 가로로 채우지 만 ElementHost를 세로로 채울 수있는 방법을 찾지 못했습니다. ElementHost의 레이아웃에 영향을 미치는 유일한 속성은 높이 및 크기 속성입니다. Anchor, Dock, AutoSize는 ActionsPane 객체 또는 ElementHost 객체에서 레이아웃에 영향을 미치지 않습니다.Excel 2003의 AutoSize ElementHostPane

내가 누락 된 항목이 있습니까?

관련,

대니

// A snippet from ThisWorkbook.cs 
public partial class ThisWorkbook 
{ 
    private void ThisWorkbook_Startup(object sender, System.EventArgs e) 
    { 

     var ap = Globals.ThisWorkbook.ActionsPane; 
     ap.Clear(); 
     ap.Visible = true; 
     var plotControl1 = new Swordfish.WPF.Charts.TestPage(); 
     var elementHost1 = new System.Windows.Forms.Integration.ElementHost(); 
     elementHost1.AutoSize = true; // Doesn't seem to have an effect. 
     elementHost1.Child = plotControl1; 

     ap.Controls.Add(elementHost1); 

    } 

답변

3

는 WPF 양식 내 ActionPane라고하고 ElementHost에 호스팅 사용자 정의를 작성합니다.

private void ThisDocument_Startup(object sender, System.EventArgs e) 
    { 
     ActionPane actionPaneControl = new ActionPane(); 
     this.ActionsPane.Resize += new EventHandler(ActionsPane_Resize); 
     this.ActionsPane.Controls.Add(new ElementHost { Child = actionPaneControl, AutoSize = true }); 
    } 

는 기본적으로 나는 ActionsPane Resize 이벤트와 크기가 떨어져 기반 ElementHost 개체를 구독 : 여기가 ElementHost 자체를했던 방법이다. 이

void ActionsPane_Resize(object sender, EventArgs e) 
    { 
     ((this.ActionsPane.Controls[0] as ElementHost).Child as ActionPane).Height = this.ActionsPane.Height; 
    } 
+0

나를 위해 일했다 Office 응용 프로그램 창에 따라 크기 조정 (VERT 및 수평 위 스트레치 모두)를 WPF의 CONTORL의 추가 측면 혜택을 제공하지만, 궁금해 어떤 다른 추가 기능이 너무 ActionsPane에 자신의 컨트롤을 추가하는 경우 ? – surfen

+0

@surfen 100 % 확신 할 수 없다. 나는 그것을 조사해야 할 것이다. –

관련 문제