I am trying to adjust the height of the custom task pane to the height of the usercontrol. My usercontrol is changing its height depending on some circumstances, so how can make custom task pane to automatically adjust to the height of the usercontrol?
I have subscribed to the usercontrol size changed event and i check if the height has changed. if so the I try to modify the custom task pane height to that value. The problem here is that the height of the usercontrol is as double and the height of the task pane is in points. So how to convert double to points?
I have set task pane height to a fixed value that is fine for my screen resolution but when showing it in another screen resolution, the custom task pane height gets bigger.
Below the code:
int maxHeight = this.ctp.Height;
foreach (System.Windows.Forms.Control c in this.ctp.Control.Controls)
{
if (c.Height > maxHeight)
{
maxHeight = c.Height;
}
}
this.ctp.Height = maxHeight;