2016-07-15 12 views
1

私は、Outlookアドインを作成し、ここに私の画面の大きさと、それが適切探している解像度に応じてタスクペインの幅をハードコーディングイムを自動サイズ調整の見通しカスタムタスクペイン自動的

private void ThisAddIn_Startup(object sender, System.EventArgs e) 
     { 
      taskpane = this.CustomTaskPanes.Add(new UCMaster(), "Summit Service Management"); 
      UserControl ucmaster = taskpane.Control; 
      eh = new ElementHost { Child = new WPFUCMaster(new WPFUCLogin()) }; 
      eh.Dock = DockStyle.Fill; 
      eh.AutoSize = true; 
      ucmaster.Controls.Add(eh); 
      taskpane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight; 
      taskpane.DockPositionRestrict = Office.MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoChange; 
      taskpane.Width = 460; 
      taskPaneWidth = taskpane.Width; 
      taskPaneHeight = taskpane.Height; 
      ucmaster.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right);   
      ucmaster.AutoSizeMode = AutoSizeMode.GrowAndShrink; 
      ucmaster.AutoSize = true; 
      int h = ucmaster.Height; 
      int w = ucmaster.Width; 
      initialAddinInstance = this; 
      ucmaster.BringToFront(); 
     } 

をカスタムタスクペインを追加しました。

しかし、タスクペインのように見えるさまざまな画面が圧縮されているなど、他の方法で表示されています。

私の質問は、現在のシステム画面の解像度と寸法に応じて、どのように作業領域幅を動的に変更できますか?

答えて

1

コンテナコントロールの場合「AutoScaleMode」は継承する必要があり、リーフコントロールの場合はFontにする必要があります。 これを試してください: ucmaster.AutoScaleMode = AutoScaleMode.Inherit; および 子ユーザーのコントロールを次のように設定します。 ucChild.AutoScaleMode = AutoScaleMode.Font;

関連する問題