Beispiel #1
0
        public void updateElementControl(int ID)
        {
            WElement ct = getElementControl(ID);
            CElement el = elements.getID(ID);

            if (ct == null || el == null)
            {
                return;
            }

            ct.Width  = el.getWidth();
            ct.Height = el.getHeight();
            Canvas.SetLeft(ct, el.getLeft());
            Canvas.SetTop(ct, el.getTop());
            ct.Source = el.getImage();
        }
Beispiel #2
0
        public WElement addElementControl(CElement item)
        {
            WElement pc = new WElement();

            pc.ElementID = item.ID;
            Canvas.SetLeft(pc, item.getLeft());
            Canvas.SetTop(pc, item.getTop());
            pc.Stretch = Stretch.Fill;

            try
            {
                pc.Width  = item.getWidth();
                pc.Height = item.getHeight();
            }
            catch (Exception)
            {
            }
            pc.Source      = item.getImage();
            pc.ElementName = item.Name;
            pc.Tip         = item.Type == "Text" ? WElement.ETip.Text : WElement.ETip.Icon;
            if (item.Properties.exist("Size"))
            {
                pc.Size = Convert.ToInt32(item.Properties.getVal("Size").ToString());
            }
            else
            {
                pc.Size = 10;
            }
            if (item.Properties.exist("Color"))
            {
                pc.TColor = item.Properties.getVal("Color").ToString();
            }

            panel1.Children.Add(pc);

            return(pc);
        }