CalculateWidthOrHeight
(
Boolean bCalculateWidth
)
{
AssertValid();
m_bCalculatingHeightOrWidth = true;
Double dNodeXLControlAspectRatio =
(Double)m_oNodeXLControlSizePx.Width /
(Double)m_oNodeXLControlSizePx.Height;
Int32 iOtherDimension;
if ( bCalculateWidth ? ValidateHeight(out iOtherDimension) :
ValidateWidth(out iOtherDimension) )
{
Int32 iCalculatedDimension;
NumericUpDown oCalculatedNumericUpDown;
if (bCalculateWidth)
{
iCalculatedDimension = (Int32)
( (Double)iOtherDimension * dNodeXLControlAspectRatio );
oCalculatedNumericUpDown = nudWidth;
}
else
{
iCalculatedDimension = (Int32)
( (Double)iOtherDimension / dNodeXLControlAspectRatio );
oCalculatedNumericUpDown = nudHeight;
}
if (iCalculatedDimension >= oCalculatedNumericUpDown.Minimum &&
iCalculatedDimension <= oCalculatedNumericUpDown.Maximum)
{
oCalculatedNumericUpDown.Value = iCalculatedDimension;
}
else
{
oCalculatedNumericUpDown.Text = String.Empty;
}
}
m_bCalculatingHeightOrWidth = false;
}