本文整理汇总了C#中CardMaker.XML.ProjectLayoutElement.GetElementFont方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectLayoutElement.GetElementFont方法的具体用法?C# ProjectLayoutElement.GetElementFont怎么用?C# ProjectLayoutElement.GetElementFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CardMaker.XML.ProjectLayoutElement
的用法示例。
在下文中一共展示了ProjectLayoutElement.GetElementFont方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateElementValues
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;
}
}
示例2: DrawElement
public static void DrawElement(Graphics zGraphics, Deck zDeck, ProjectLayoutElement zElement, ElementType eType, int nX, int nY, string sInput)
{
switch (eType)
{
case ElementType.Graphic:
case ElementType.Shape:
sInput = sInput.Trim();
break;
}
Font zFont = null;
Brush zBrush = null;
Pen zBorderPen = null;
Color colorFont = Color.Black;
if (0 != zElement.borderthickness)
{
zBorderPen = 255 != zElement.opacity
? new Pen(Color.FromArgb(zElement.opacity, zElement.GetElementBorderColor()), zElement.borderthickness)
: new Pen(zElement.GetElementBorderColor(), zElement.borderthickness);
}
// Setup
switch (eType)
{
case ElementType.Text:
case ElementType.FormattedText:
zFont = zElement.GetElementFont();
colorFont = zElement.GetElementColor();
zBrush = new SolidBrush(colorFont);
break;
case ElementType.Graphic:
case ElementType.Shape:
break;
default:
return;
}
// NOTE: this is the first transform
if (0 != zElement.rotation)
{
// center the internal element then rotate and restore
zGraphics.TranslateTransform(zElement.x + nX + (zElement.width >> 1), zElement.y + nY + (zElement.height >> 1));
zGraphics.RotateTransform(zElement.rotation);
zGraphics.TranslateTransform(-(zElement.width >> 1), -(zElement.height >> 1));
}
else
{
zGraphics.TranslateTransform(zElement.x + nX, zElement.y + nY);
}
// TODO: an interface for all these would be more appropriate
// Draw
switch (eType)
{
case ElementType.Text:
DrawText(zGraphics, zElement, sInput, zBrush, zFont, colorFont);
break;
case ElementType.FormattedText:
DrawFormattedText(zGraphics, zDeck, zElement, sInput, zBrush, zFont, colorFont);
break;
case ElementType.Graphic:
DrawGraphic(zGraphics, sInput, zElement);
break;
case ElementType.Shape:
ShapeManager.HandleShapeRender(zGraphics, sInput.ToLower(), zElement);
break;
}
if (null != zBorderPen)
{
// note that the border is inclusive in the width/height consuming 2 pixels (0 to total-1)
zGraphics.DrawRectangle(zBorderPen, 0,0,zElement.width - 1, zElement.height - 1);
}
zGraphics.ResetTransform();
}