private void UpdateElementValues(ProjectLayoutElement zElement)
{
if (null != zElement)
{
m_bFireElementChangeEvents = false;
numericElementX.Value = zElement.x;
numericElementY.Value = zElement.y;
numericElementW.Value = zElement.width;
numericElementH.Value = zElement.height;
numericElementRotation.Value = (decimal)zElement.rotation;
numericElementBorderThickness.Value = (decimal)zElement.borderthickness;
numericElementOutLineThickness.Value = (decimal)zElement.outlinethickness;
numericLineSpace.Value = (decimal)zElement.lineheight;
numericWordSpace.Value = (decimal)zElement.wordspace;
checkFontAutoScale.Checked = zElement.autoscalefont;
checkLockAspect.Checked = zElement.lockaspect;
checkKeepOriginalSize.Checked = zElement.keeporiginalsize;
numericElementOpacity.Value = (decimal)zElement.opacity;
comboTextHorizontalAlign.SelectedIndex = zElement.horizontalalign;
comboTextVerticalAlign.SelectedIndex = zElement.verticalalign;
comboGraphicHorizontalAlign.SelectedIndex = zElement.horizontalalign;
comboGraphicVerticalAlign.SelectedIndex = zElement.verticalalign;
txtElementVariable.Text = zElement.variable;
txtElementVariable.SelectionStart = zElement.variable.Length;
txtElementVariable.SelectionLength = 0;
ElementType eType = m_dictionaryElementTypes[zElement.type];
switch (eType)
{
case ElementType.Shape:
// configure the combo box and property grid for the shap
string sType = AbstractShape.GetShapeType(zElement.variable);
if (null != sType)
{
int nSelectedIndex;
if (dictionaryShapeTypeIndex.TryGetValue(sType, out nSelectedIndex))
{
comboShapeType.SelectedIndex = nSelectedIndex;
var zShape = (AbstractShape)comboShapeType.SelectedItem;
zShape.InitializeItem(zElement.variable);
// associated the prop grid with this shape object
propertyGridShape.SelectedObject = zShape;
}
}
break;
case ElementType.Text:
checkFontAutoScale.Visible = true;
lblWordSpacing.Visible = false;
numericWordSpace.Visible = false;
break;
case ElementType.FormattedText:
checkFontAutoScale.Visible = false;
lblWordSpacing.Visible = true;
numericWordSpace.Visible = true;
break;
}
comboElementType.SelectedIndex = (int)eType;
UpdatePanelColors(zElement);
groupBoxElement.Enabled = true;
Font zFont = zElement.GetElementFont();
zFont = zFont ?? DrawItem.DefaultFont;
for (int nFontIndex = 0; nFontIndex < comboFontName.Items.Count; nFontIndex++)
{
if (zFont.Name.Equals((string)comboFontName.Items[nFontIndex], StringComparison.CurrentCultureIgnoreCase))
{
comboFontName.SelectedIndex = nFontIndex;
break;
}
}
SetupElementFont(zFont);
m_bFireElementChangeEvents = true;
}
else
{
groupBoxElement.Enabled = false;
}
}