当前位置: 首页>>代码示例>>C#>>正文


C# Styles.Add方法代码示例

本文整理汇总了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;
        }
开发者ID:CarlSosaDev,项目名称:Avalonia,代码行数:14,代码来源:TestServices.cs

示例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;
//.........这里部分代码省略.........
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:101,代码来源:AttributeValuePair.cs


注:本文中的Styles.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。