Пример #1
0
        protected override void OnResize(EventArgs e)
        {
            UpdateScale();
            if (!_loaded)
            {
                return;
            }

            int coof = Scales switch {
                EScales.HD => DesignConfig.Scale.HD,
                EScales.FullHD => DesignConfig.Scale.FullHD,
                EScales.DoubleHD => DesignConfig.Scale.DoubleHD,
                EScales.FourHD => DesignConfig.Scale.FourHD,
                _ => DesignConfig.Scale.FullHD
            };

            DesignConfig.Resources.RetreatSize = (int)(def / 100f * coof);

            ControlCollectionExt.ToList(this.Controls).ForEach(control => {
                if (control is IEventFormResize element)
                {
                    element.EventFormResize(this);
                }
            });

            _locationManager?.UpdateDefValues(GetLocationManagerConfig());
            _locationManager?.ReLocateAll();

            base.OnResize(e);
        }
Пример #2
0
        public void EventFormResize(Form form)
        {
            var controls = ControlCollectionExt.ToList(this.Controls);

            controls
            .FindAll(control => control is IButtonLayerInstrument)
            .ForEach(control => {
                if (control is IEventFormResize element)
                {
                    element.EventFormResize(form);
                }
            });

            //SetNew Width for ButtonLayer by count of ButtonInstruments
            DesignConfig.PanelLayerConfig.ButtonLayerConfig.WidthDef  =
                DesignConfig.PanelLayerConfig.ButtonLayerConfig.Width =
                    DesignConfig.PanelLayerConfig.InstrumentsInRow *
                    (DesignConfig.PanelLayerConfig.ButtonInstrumentsConfig.Width + DesignConfig.Resources.RetreatSize) -
                    (DesignConfig.Resources.RetreatSize);

            RePaint();
            controls
            .FindAll(control => control is IButtonLayer)
            .ForEach(control => {
                if (control is IEventFormResize element)
                {
                    element.EventFormResize(form);
                }
            });
        }
Пример #3
0
        public void EventFormResize(Form form)
        {
            ControlCollectionExt.ToList(this.Controls).ForEach(control => {
                if (control is IEventFormResize element)
                {
                    element.EventFormResize(form);
                }
            });

            RePaint();
        }
Пример #4
0
        public void ReLocateAll()
        {
            ControlCollectionExt.ToList(this.Controls).ForEach(control => {
                if (control is IReLocateControl reLocateControl)
                {
                    reLocateControl.LocationManager = LocationManager;
                }
            });

            LocationManager?.ReLocateAll();
        }
Пример #5
0
        public void EventFormResize(Form form) {
            _buttonTransform1.Location = new Point(0, DesignConfig.Resources.RetreatSize);
            
            var controls = ControlCollectionExt.ToList(this.Controls);
            controls.ForEach(control => {
                if (control is IEventFormResize element) {
                    element.EventFormResize(form);
                }
            });


            RePaint();
        }
Пример #6
0
        public void EventFormResize(Form form)
        {
            ControlCollectionExt.ToList(this.Controls).ForEach(control => {
                if (control is IEventFormResize element)
                {
                    element.EventFormResize(form);
                }
            });

            DesignConfig.PanelMainConfig.Width  = form.Width;
            DesignConfig.PanelMainConfig.Height = DesignConfig.PanelMainConfig.Button.Height + (DesignConfig.Resources.RetreatSize * 2);

            RePaint();
        }
Пример #7
0
        public override void RePaint()
        {
            int xMargin = DesignConfig.Resources.RetreatSize;;
            int yMargin = (int)((DesignConfig.PanelMainConfig.Height - DesignConfig.PanelMainConfig.Button.Height) / 2f);

            ControlCollectionExt.ToList(this.Controls).ForEach(control => {
                control.Location = new Point(xMargin, yMargin);
                xMargin         += control.Width + DesignConfig.Resources.RetreatSize;;
            });

            this.BackColor = DesignConfig.ColorConfig.SecondBackColor;
            this.Height    = DesignConfig.PanelMainConfig.Height;
            this.Width     = DesignConfig.PanelMainConfig.Width;
        }
Пример #8
0
        public void EventFormResize(Form form)
        {
            ControlCollectionExt.ToList(this.Controls).ForEach(control => {
                if (control is IEventFormResize element)
                {
                    element.EventFormResize(form);
                }
                _contextMenu.EventFormResize(form);
            });

            DesignConfig.PanelToolBox.Height = form.Height;
            DesignConfig.PanelToolBox.Width  = DesignConfig.PanelToolBox.Button.Width + (DesignConfig.Resources.RetreatSize);

            RePaint();
        }
Пример #9
0
        private void AddLocationManager()
        {
            _locationManager = new LocationManager(GetLocationManagerConfig(), DesignConfig);

            ControlCollectionExt.ToList(this.Controls).ForEach(control => {
                if (control is IReLocateControl reLocateControl)
                {
                    reLocateControl.LocationManager = _locationManager;
                }
            });


            _locationManager.AddPanel(_panelMain1, LocationSide.StaticUP, 1);
            _locationManager.AddPanel(_panelToolBox, LocationSide.StaticLeft, 1);
            _locationManager.AddPanel(_panelInstrumentPanel1, LocationSide.Left, 1);
            _locationManager.AddPanel(_panelLayerVer1, LocationSide.Left, 2);
            _locationManager.AddPanel(_panelLayerVer2, LocationSide.Left, 3);
            _locationManager.AddPanel(_panelLayerVer3, LocationSide.Left, 4);

            _locationManager.ReLocateAll();
        }
Пример #10
0
        public override void RePaint()
        {
            this.Width = DesignConfig.PanelLayerConfig.ButtonLayerConfig.Width
                         + (DesignConfig.Resources.RetreatSize * 2);

            var controls = ControlCollectionExt.ToList(this.Controls);

            int xLevel = DesignConfig.Resources.RetreatSize;
            int yLevel = DesignConfig.Resources.RetreatSize;

            //add ButtonTransform
            _buttonTransform1.Location = new Point(0, yLevel);
            _buttonTransform1.Width    = this.Width;
            _buttonTransform1.Height   = DesignConfig.PanelLayerConfig.ButtonInstrumentsConfig.Height;
            yLevel += _buttonTransform1.Height + DesignConfig.Resources.RetreatSize;

            //add ButtonInstrument
            int count = 0;

            controls.ForEach(control => {
                if (control is IButtonLayerInstrument)
                {
                    control.Location = new Point(xLevel, yLevel);

                    xLevel += DesignConfig.PanelLayerConfig.ButtonInstrumentsConfig.Width +
                              DesignConfig.Resources.RetreatSize;

                    count++;
                    if (count >= DesignConfig.PanelLayerConfig.InstrumentsInRow)
                    {
                        count   = 0;
                        xLevel  = DesignConfig.Resources.RetreatSize;
                        yLevel += DesignConfig.PanelLayerConfig.ButtonInstrumentsConfig.Height +
                                  DesignConfig.Resources.RetreatSize;
                    }
                }
            });

            //add BackgroundFon for ButtonLayer
            if (count != 0)
            {
                //Add new retreat if need
                yLevel += DesignConfig.PanelLayerConfig.ButtonInstrumentsConfig.Height +
                          DesignConfig.Resources.RetreatSize;
            }

            _layersBack.Location = new Point(0, yLevel);
            _layersBack.Width    = Width;
            _layersBack.Height   = 0;

            //add ButtonLayer
            yLevel += DesignConfig.Resources.RetreatSize;
            xLevel  = DesignConfig.Resources.RetreatSize;
            int backHeight = 0;

            controls.ForEach(control => {
                if (control is IButtonLayer)
                {
                    control.Location = new Point(xLevel, yLevel);

                    int addHeight = DesignConfig.PanelLayerConfig.ButtonLayerConfig.Height + DesignConfig.Resources.RetreatSize;
                    yLevel       += addHeight;
                    backHeight   += addHeight;
                }
            });

            //set final height for panel and backButtonLayers
            _layersBack.Height = backHeight + DesignConfig.Resources.RetreatSize;
            this.Height        = yLevel + DesignConfig.Resources.RetreatSize;

            ReLocateAll();
        }