Exemplo n.º 1
0
        private void Panel1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.IsDown && e.Key == Key.D && Keyboard.Modifiers == ModifierKeys.Control)
            {
                CElement el = getSelectedElement();
                if (el != null)
                {
                    CElement nw = el.Clone();
                    nw.ID = UniqueID++;
                    nw.setLeft(nw.getLeft() + 10);
                    nw.setTop(nw.getTop() + 10);
                    elements.Add(nw);
                    WElement cnw = addElementControl(nw);
                    Panel.SetZIndex(cnw, panel1.zindex++);
                    SetSelectedElement(cnw.ElementID);

                    lwElementList.Items.Add(nw);

                    for (int i = 0; i < lwElementList.Items.Count; i++)
                    {
                        if (((CElement)lwElementList.Items[i]).ID == cnw.ElementID)
                        {
                            lwElementList.SelectedIndex = i;
                            break;
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        internal void onPropertyChanged(CustomProperty _owner, object value)
        {
            WElement wc = getSelectedElementControl();
            CElement el = getSelectedElement();

            if (wc == null)
            {
                return;
            }

            if (_owner.Name.Trim().ToLower() == "visible" && _owner.WProp)
            {
                wc.Visibility = (bool)value == true ? Visibility.Visible : Visibility.Hidden;
            }

            if (_owner.WProp && _owner.Category.Trim().ToLower() == "rect")
            {
                if (_owner.Name.Trim() == "Width")
                {
                    el.setWidth((int)value);
                }
                if (_owner.Name.Trim() == "Height")
                {
                    el.setHeight((int)value);
                }
                if (_owner.Name.Trim() == "Left")
                {
                    el.setLeft((int)value);
                }
                if (_owner.Name.Trim() == "Top")
                {
                    el.setTop((int)value);
                }

                updateElementControl(el.ID);
            }
        }