本文整理汇总了C#中Styles.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Styles.Add方法的具体用法?C# Styles.Add怎么用?C# Styles.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Styles
的用法示例。
在下文中一共展示了Styles.Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateDefaultTheme
private static Styles CreateDefaultTheme()
{
var result = new Styles
{
new DefaultTheme(),
};
var loader = new AvaloniaXamlLoader();
var baseLight = (IStyle)loader.Load(
new Uri("resm:Avalonia.Themes.Default.Accents.BaseLight.xaml?assembly=Avalonia.Themes.Default"));
result.Add(baseLight);
return result;
}
示例2: CreateFromsStrings
internal static AttributeValuePair CreateFromsStrings(string attr, string val) {
var av = new AttributeValuePair();
string name = attr.ToLower();
switch (name) {
case "uri":
av.attributeTypeEnum = AttributeTypeEnum.Uri;
av.val = val;
break;
case "constraint":
av.attributeTypeEnum = AttributeTypeEnum.Constraint;
av.val = val != "false";
break;
case "label":
av.attributeTypeEnum = AttributeTypeEnum.Label;
av.val = val;
break;
case "size":
av.attributeTypeEnum = AttributeTypeEnum.Size;
av.val = ParseP2(val);
break;
case "style":
{
Styles styles = new Styles();
av.val = styles;
string[] vals = Split(val);
av.attributeTypeEnum = AttributeTypeEnum.Style;
for (int i = 0; i < vals.Length; ++i)
{
switch (vals[i])
{
case "filled": styles.Add(Style.Filled); break;
case "dashed": styles.Add(Style.Dashed); break;
case "solid": styles.Add(Style.Solid); break;
case "invis":
case "inviz":
case "hidden": styles.Add(Style.Invis); break;
case "bold": styles.Add(Style.Bold); break;
case "diagonals": styles.Add(Style.Diagonals); break;
case "dotted": styles.Add(Style.Dotted); break;
case "rounded": styles.Add(Style.Rounded); break;
default:
int lw;
if (ParseLineWidth(vals[i], out lw)) {
styles.lineWidth = lw;
break;
}
throw new Exception(String.Format("unexpected style '{0}'", val));
}
}
break;
}
case "color":
av.attributeTypeEnum = AttributeTypeEnum.Color;
av.val = val;
break;
case "pos":
av.attributeTypeEnum = AttributeTypeEnum.Pos;
av.val = CreatePosData(val);
break;
case "lp":
av.attributeTypeEnum = AttributeTypeEnum.LabelLocation;
av.val = CreatePosData(val);
break;
case "fontname":
av.attributeTypeEnum = AttributeTypeEnum.Fontname;
av.val = val;
break;
case "fontsize":
av.attributeTypeEnum = AttributeTypeEnum.FontSize;
av.val = (int)TryParseDouble(val, name);
break;
case "rankdir":
av.attributeTypeEnum = AttributeTypeEnum.LayerDirection;
switch(val) {
case "LR": av.val = LayerDirection.LR; break;
case "TB":
case "TD": av.val = LayerDirection.TB; break;
case "RL": av.val = LayerDirection.RL; break;
case "BT": av.val = LayerDirection.BT; break;
default:
throw new Exception("layerdir value \"" + val + "\" is not supported");
}
break;
case "labeldouble":
av.attributeTypeEnum = AttributeTypeEnum.Ignore;
break;
case "bb":
av.attributeTypeEnum = AttributeTypeEnum.BBox;
av.val = CreateBBoxFromString(val);
break;
case "fontcolor":
av.attributeTypeEnum = AttributeTypeEnum.Fontcolor;
av.val = val;
break;
case "margin":
{
// a pair x,y (inches)
av.attributeTypeEnum = AttributeTypeEnum.Margin;
//.........这里部分代码省略.........