本文整理汇总了C#中Component.GetFormattedProperty方法的典型用法代码示例。如果您正苦于以下问题:C# Component.GetFormattedProperty方法的具体用法?C# Component.GetFormattedProperty怎么用?C# Component.GetFormattedProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Component
的用法示例。
在下文中一共展示了Component.GetFormattedProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public void Render(Component component, CircuitDiagram.Render.IRenderContext dc, bool absolute)
{
Point renderLocation = Location.Resolve(component);
TextAlignment tempAlignment = Alignment;
if (component.IsFlipped && component.Orientation == Orientation.Horizontal)
{
switch (Alignment)
{
case TextAlignment.BottomLeft:
tempAlignment = TextAlignment.BottomRight;
break;
case TextAlignment.BottomRight:
tempAlignment = TextAlignment.BottomLeft;
break;
case TextAlignment.CentreLeft:
tempAlignment = TextAlignment.CentreRight;
break;
case TextAlignment.CentreRight:
tempAlignment = TextAlignment.CentreLeft;
break;
case TextAlignment.TopLeft:
tempAlignment = TextAlignment.TopRight;
break;
case TextAlignment.TopRight:
tempAlignment = TextAlignment.TopLeft;
break;
}
}
else if (component.IsFlipped && component.Orientation == Orientation.Vertical)
{
switch (Alignment)
{
case TextAlignment.BottomCentre:
tempAlignment = TextAlignment.TopCentre;
break;
case TextAlignment.BottomLeft:
tempAlignment = TextAlignment.TopLeft;
break;
case TextAlignment.BottomRight:
tempAlignment = TextAlignment.TopRight;
break;
case TextAlignment.TopCentre:
tempAlignment = TextAlignment.BottomCentre;
break;
case TextAlignment.TopLeft:
tempAlignment = TextAlignment.BottomLeft;
break;
case TextAlignment.TopRight:
tempAlignment = TextAlignment.BottomRight;
break;
}
}
List<TextRun> renderTextRuns = new List<TextRun>(TextRuns.Count);
// Build runs
foreach (TextRun run in TextRuns)
{
// Resolve value
string renderValue;
if (run.Text.StartsWith("$"))
{
ComponentProperty property = component.FindProperty(run.Text);
renderValue = component.GetFormattedProperty(property);
}
else
renderValue = run.Text;
System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"\\[uU]([0-9A-F]{4})");
renderValue = regex.Replace(renderValue, match => ((char)Int32.Parse(match.Value.Substring(2), System.Globalization.NumberStyles.HexNumber)).ToString());
renderTextRuns.Add(new TextRun(renderValue, run.Formatting));
}
if (absolute)
dc.DrawText(Point.Add(renderLocation, component.Location), tempAlignment, renderTextRuns);
else
dc.DrawText(renderLocation, tempAlignment, renderTextRuns);
}