示例#1
0
        public Block(String code, Block parent)
        {
            Aleros.CSS.Selector selector = new Aleros.CSS.Selector("@internal", code);
            this.Padding = new Padding("0");
            this.Margin = new Margin("1");
            foreach (Aleros.CSS.Rule rule in selector.rules)
            {
                if (rule.rule == "-alternative-background-color")
                {
                    this.AlternateBackColor = ColorTranslator.FromHtml(rule.value);
                }
                else
                {
                    this.AlternateBackColor = parent.BackColor;
                }
                if (rule.rule == "background" || rule.rule == "background-color")
                {
                    this.BackColor = ColorTranslator.FromHtml(rule.value);
                }
                else
                {
                    this.BackColor = parent.BackColor;
                }
                if (rule.rule == "font-color")
                {
                        this.ForeColor = ColorTranslator.FromHtml(rule.value);
                }
                else
                {
                    this.ForeColor = parent.ForeColor;
                }
                if (rule.rule == "padding")
                {
                    this.Padding = new Padding(rule.value);
                }
                else
                {
                    this.Padding = parent.Padding;
                }
                if (rule.rule == "margin")
                {
                    this.Margin = new Margin(rule.value);
                }
                else
                {
                    this.Margin = parent.Margin;
                }

            }
        }
示例#2
0
 public Selector(String code, Selector parent)
 {
     Aleros.CSS.Selector selector = new Aleros.CSS.Selector("@internal", code);
     this.Padding = new Padding("0");
     this.Margin  = new Margin("1");
     foreach (Aleros.CSS.Rule rule in selector.rules)
     {
         if (rule.rule == "background" || rule.rule == "background-color")
         {
             this.BackColor = ColorTranslator.FromHtml(rule.value);
         }
         else
         {
             this.BackColor = parent.BackColor;
         }
         if (rule.rule == "font-color")
         {
             this.ForeColor = ColorTranslator.FromHtml(rule.value);
         }
         else
         {
             this.ForeColor = parent.ForeColor;
         }
         if (rule.rule == "padding")
         {
             this.Padding = new Padding(rule.value);
         }
         else
         {
             this.Padding = parent.Padding;
         }
         if (rule.rule == "margin")
         {
             this.Margin = new Margin(rule.value);
         }
         else
         {
             this.Margin = parent.Margin;
         }
     }
 }
示例#3
0
 public Block(Style parentStyle, String code, Block parent)
 {
     Aleros.CSS.Selector selector = new Aleros.CSS.Selector("@internal", code);
     this.Padding = new Padding("0");
     this.Margin  = new Margin("1");
     foreach (Aleros.CSS.Rule rule in selector.rules)
     {
         if (rule.rule == "-alternative-background-color")
         {
             this.AlternateBackColor = ColorTranslator.FromHtml(rule.value);
         }
         else
         {
             this.AlternateBackColor = parent.BackColor;
         }
         if (rule.rule == "background" || rule.rule == "background-color")
         {
             try
             {
                 CSSFunction func      = new CSSFunction(rule.value);
                 String      imageName = func.Arguments[0];
                 int         x         = int.Parse(func.Arguments[1]);
                 int         y         = int.Parse(func.Arguments[2]);
                 int         width     = int.Parse(func.Arguments[3]);
                 int         height    = int.Parse(func.Arguments[4]);
                 if (func.Name == "-spider-slice-bitmap")
                 {
                     this.BackgroundImage = sliceBitmap((Bitmap)parentStyle.Images[imageName], new Rectangle(x, y, width, height));
                 }
             }
             catch (Exception e)
             {
                 this.BackColor = ColorTranslator.FromHtml(rule.value);
             }
         }
         else
         {
             this.BackColor = parent.BackColor;
         }
         if (rule.rule == "font-color")
         {
             this.ForeColor = ColorTranslator.FromHtml(rule.value);
         }
         else
         {
             this.ForeColor = parent.ForeColor;
         }
         if (rule.rule == "padding")
         {
             this.Padding = new Padding(rule.value);
         }
         else
         {
             this.Padding = parent.Padding;
         }
         if (rule.rule == "margin")
         {
             this.Margin = new Margin(rule.value);
         }
         else
         {
             this.Margin = parent.Margin;
         }
     }
 }
示例#4
0
        public Block(Style parentStyle, String code, Block parent)
        {
            Aleros.CSS.Selector selector = new Aleros.CSS.Selector("@internal", code);
            this.Padding = new Padding("0");
            this.Margin = new Margin("1");
            foreach (Aleros.CSS.Rule rule in selector.rules)
            {
                if (rule.rule == "-alternative-background-color")
                {
                    this.AlternateBackColor = ColorTranslator.FromHtml(rule.value);
                }
                else
                {
                    this.AlternateBackColor = parent.BackColor;
                }
                if (rule.rule == "background" || rule.rule == "background-color")
                {
                    try
                    {
                        CSSFunction func = new CSSFunction(rule.value);
                        String imageName = func.Arguments[0];
                        int x = int.Parse(func.Arguments[1]);
                        int y = int.Parse(func.Arguments[2]);
                        int width = int.Parse(func.Arguments[3]);
                        int height = int.Parse(func.Arguments[4]);
                        if (func.Name == "-spider-slice-bitmap")
                        {
                            this.BackgroundImage = sliceBitmap((Bitmap)parentStyle.Images[imageName], new Rectangle(x, y, width, height));
                        }
                    }
                    catch (Exception e)
                    {
                        this.BackColor = ColorTranslator.FromHtml(rule.value);
                    }
                }
                else
                {
                    this.BackColor = parent.BackColor;
                }
                if (rule.rule == "font-color")
                {
                        this.ForeColor = ColorTranslator.FromHtml(rule.value);
                }
                else
                {
                    this.ForeColor = parent.ForeColor;
                }
                if (rule.rule == "padding")
                {
                    this.Padding = new Padding(rule.value);
                }
                else
                {
                    this.Padding = parent.Padding;
                }
                if (rule.rule == "margin")
                {
                    this.Margin = new Margin(rule.value);
                }
                else
                {
                    this.Margin = parent.Margin;
                }

            }
        }