I have created an outlook addin and added a custom taskpane to it
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();
}
here im hardcoding the taskpane width according to my screen dimensions and resolution it is looking proper.
But,in different screens im observing like the task pane is getting compressed or in any other way.
my question is how can i dyanmically change the taskpane width according to the current system screen resolution and dimensions?