protected override void OnSizeChanged(EventArgs e)
{
// Skip handling this, if the DataTree hasn't
// set the official width using SetWidthForDataTreeLayout
if (!m_widthHasBeenSetByDataTree)
return;
base.OnSizeChanged (e);
if (Control.Size == m_lastSize)
return;
m_lastSize = Control.Size;
Image image = m_picBox.Image;
if (image == null || image.Width == 0)
this.Height = LabelHeight;
int idealHeight = (int)(m_aspectRatio * Control.Width);
int height = Math.Min(idealHeight, ContainingDataTree.Height / 3);
if (m_fThumbnail && height > 80)
height = 80;
this.Height = Math.Max(LabelHeight, height);
m_picBox.Height = this.Height;
if (Control.Height != this.Height)
Control.Height = this.Height;
if (height < idealHeight)
{
m_picBox.Width = (int)(Control.Height / m_aspectRatio);
}
else
{
m_picBox.Width = Control.Width;
}
}