예제 #1
0
        public Window_AllControls(Canvas canvas, string Text)
        {
            InitializeComponent();

            Title += " - " + Text;

            int i = 0;

            foreach (FrameworkElement elem in canvas.Children)
            {
                if (elem.Tag == null || elem.Tag.ToString() != "!S!")
                {
                    MenuItem   item  = new MenuItem();
                    StackPanel panel = new StackPanel();
                    Label      lab   = new Label();
                    lab.Content    = ControlNameWorker.GetTypeName(elem, out property);
                    lab.FontWeight = FontWeights.Bold;
                    Label lab2 = new Label();
                    lab2.Content = "X: " + elem.GetValue(Canvas.LeftProperty) + "   Y: " + elem.GetValue(Canvas.TopProperty) + "   Z: " + Panel.GetZIndex(elem) + "   " + Strings.ResStrings.ID + ": " + ControlWorker.GetID(elem.Name) + "    " + property;
                    panel.Children.Add(lab);
                    panel.Children.Add(lab2);
                    panel.Orientation = Orientation.Horizontal;

                    item.Header = panel;
                    item.Click += Item_Click;
                    item.Tag    = elem;
                    Menu_list.Items.Add(item);
                    i++;
                }
            }

            property = "";
        }
예제 #2
0
        public Page_MultiSelect(Canvas canvas, List <FrameworkElement> selectedcontrols, double lowX, double lowY, double maxX, double maxY)
        {
            InitializeComponent();
            Selectedcontrols = new List <FrameworkElement>(selectedcontrols);
            designcanvas     = canvas;

            foreach (FrameworkElement cont in Selectedcontrols)
            {
                FlatButtonContent flatButton = new FlatButtonContent();
                string            par;


                TextBlock label = new TextBlock();
                label.TextWrapping = TextWrapping.Wrap;
                label.Inlines.Add(new Run(ControlNameWorker.GetTypeName(cont, out par) + Environment.NewLine)
                {
                    FontWeight = FontWeights.Bold
                });
                label.Inlines.Add(new Run("X: " + Math.Round(Canvas.GetLeft(cont), 2) + Environment.NewLine));
                label.Inlines.Add(new Run("Y: " + Math.Round(Canvas.GetTop(cont), 2) + Environment.NewLine));
                label.Inlines.Add(new Run("W: " + Math.Round(cont.Width, 2) + Environment.NewLine));
                label.Inlines.Add(new Run("H: " + Math.Round(cont.Height, 2)));

                flatButton.contentPresenter.Content             = label;
                flatButton.contentPresenter.HorizontalAlignment = HorizontalAlignment.Left;
                flatButton.contentPresenter.Margin = new Thickness(5);
                flatButton.MinHeight       = 24;
                flatButton.MinWidth        = 24;
                flatButton.Tag             = cont;
                flatButton.BorderBrush     = new SolidColorBrush(Colors.Black);
                flatButton.BorderThickness = new Thickness(1);
                flatButton.Foreground      = new SolidColorBrush(Colors.White);
                flatButton.Background      = new SolidColorBrush(Color.FromRgb(52, 73, 94));
                flatButton.DefaultBrush    = new SolidColorBrush(Color.FromRgb(52, 73, 94));
                flatButton.Hover           = new SolidColorBrush(Color.FromArgb(180, 52, 73, 94));
                flatButton.ClickBrush      = new SolidColorBrush(Color.FromArgb(100, 52, 73, 94));

                flatButton.MouseLeftButtonUp += FlatButton_MouseLeftButtonUp;

                SP_AllControls.Children.Add(flatButton);
            }

            LowX = lowX;
            LowY = lowY;
            MaxX = maxX;
            MaxY = maxY;

            DLowX = lowX;
            DLowY = lowY;
            DMaxX = maxX;
            DMaxY = maxY;

            LoadData();
        }
예제 #3
0
        private void ListControls_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (ListControls.SelectedIndex >= 0)
            {
                StackPanel stc = ((StackPanel)ListControls.SelectedItem);

                int iC = int.Parse(stc.Tag.ToString());

                if (ClickControl != null)
                {
                    ClickControl(canvas.Children[iC]);
                }

                Sel_Label.Content = "[" + ControlWorker.GetID(((FrameworkElement)canvas.Children[iC]).Name) + "] " + ControlNameWorker.GetTypeName(canvas.Children[iC], out txt);
                SelectedI         = iC;
                CB_Type_SelectionChanged(null, null);

                AnimPanel.SelectedIndex = -1;
            }
        }
예제 #4
0
        public void GetControls()
        {
            for (int i = 0; i < canvas.Children.Count; i++)
            {
                if (((FrameworkElement)canvas.Children[i]).Tag == null || ((FrameworkElement)canvas.Children[i]).Tag.ToString() != "!S!")
                {
                    StackPanel item = new StackPanel();
                    item.Tag = i;
                    Label lab = new Label()
                    {
                        Content = "[" + ControlWorker.GetID(((FrameworkElement)canvas.Children[i]).Name) + "] " + ControlNameWorker.GetTypeName(canvas.Children[i], out txt)
                    };
                    item.Children.Add(lab);
                    ListControls.Items.Add(item);

                    if (OBJSelected != null)
                    {
                        Debug.WriteLine("" + OBJSelected);
                        if (OBJSelected == canvas.Children[i])
                        {
                            ListControls.SelectedIndex = i;
                            Sel_Label.Content          = "[" + ControlWorker.GetID(((FrameworkElement)canvas.Children[i]).Name) + "] " + ControlNameWorker.GetTypeName(canvas.Children[i], out txt);
                            SelectedI = i;
                        }
                    }
                }
            }
        }
예제 #5
0
        void RefreshAnimList()
        {
            if (Pid >= 0)
            {
                AnimPanel.Items.Clear();
                int k = 0;

                List <IAnimation> Removelist = new List <IAnimation>();

                foreach (IAnimation ian in data.pages[Pid].AnimationList)
                {
                    FrameworkElement felm = ControlWorker.FindChild <FrameworkElement>(canvas, "ID_" + ian.GetID());

                    if (felm != null)
                    {
                        StackPanel stc = new StackPanel();
                        stc.Orientation = Orientation.Horizontal;

                        /*
                         * if ((k % 2) == 0)
                         *  stc.Background = new SolidColorBrush(Color.FromRgb(189, 195, 199));
                         * else
                         *  stc.Background = new SolidColorBrush(Color.FromRgb(236, 240, 241));
                         */


                        Label lbl = new Label();
                        lbl.Content = (k + 1) + ".   [" + ian.GetID() + "] " + ControlNameWorker.GetTypeName(felm, out txt);

                        Image img = new Image();

                        if (ian is Animation_Position)
                        {
                            img.Source = new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Resources/Animations/OpacityAnimation.png"));
                        }
                        else if (ian is Animation_Size)
                        {
                            img.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resources/Animations/Scale.png"));
                        }

                        img.Width  = 32;
                        img.Height = 32;

                        stc.Children.Add(img);
                        stc.Children.Add(lbl);

                        //stc.MouseLeftButtonDown += Stc_MouseLeftButtonDown;

                        stc.Tag = ian;

                        AnimPanel.Items.Add(stc);
                        k++;
                    }
                    else
                    {
                        Removelist.Add(ian);
                    }
                }

                foreach (IAnimation ian in Removelist)
                {
                    data.pages[Pid].AnimationList.Remove(ian);
                }
            }
        }
예제 #6
0
        public Window_ControlsID(Canvas canvas)
        {
            InitializeComponent();

            string prp;

            for (int i = 0; i < canvas.Children.Count; i++)
            {
                SP_ControlsID.Children.Add(new Label()
                {
                    Content = "[" + ControlWorker.GetID(((FrameworkElement)canvas.Children[i]).Name) + "] - " + ControlNameWorker.GetTypeName(canvas.Children[i], out prp)
                });
            }
        }