Exemplo n.º 1
0
        private LedRound CreateLED(Control c)
        {
            LedRound led = new LedRound();

            led.Name = FuncGeneral.GetControlName(led);
            c.Controls.Add(led);
            return(led);
        }
Exemplo n.º 2
0
        private void CreateSymbols()
        {
            int      pageNr          = 0;
            string   symbolName      = "";
            string   groupName       = "";
            string   comment         = "";
            string   groupNameBefore = "";
            int      row             = 0;
            GroupBox groupBoxBefore  = null;
            GroupBox groupBox        = null;

            foreach (PLCDatas data in m_glb_PLC.Daten)
            {
                if (data.DatabaseNumber == 54)
                {
                    m_Releases.Add(data.Symbolname, data.Comment);
                }
            }
            List <string> sortList = m_Releases.Keys.ToList();

            sortList.Sort();
            groupNameBefore = "";
            int topGroupBox    = 0;
            int colomnGroupBox = 0;

            int tabPagegheight = 0;
            int rest           = 0;

            foreach (string symbol in sortList)
            {
                symbolName = symbol;
                comment    = m_Releases[symbolName];
                string[] kom = comment.Split(':');
                comment   = kom[1];
                groupName = kom[0];
                if (groupNameBefore != groupName)
                {
                    row = 0;
                    if (groupBoxBefore == null)
                    {
                        topGroupBox    = GlobalVar.Const_ControlSpacing;
                        colomnGroupBox = 0;
                    }
                    else
                    {
                        tabPagegheight = this.m_TabControlDaten.Height - this.m_TabControlDaten.ItemSize.Height - 8;
                        rest           = tabPagegheight - groupBoxBefore.Top - groupBoxBefore.Height - GlobalVar.Const_GroupBoxOffsetRest;
                        if (rest < 0)
                        {
                            topGroupBox = GlobalVar.Const_ControlSpacing;
                            colomnGroupBox++;
                            if (colomnGroupBox > 1)
                            {
                                colomnGroupBox = 0;
                                groupBoxBefore = null;
                                row            = 0;
                                this.CreatePage();
                                pageNr++;
                            }
                        }
                        else
                        {
                            topGroupBox = groupBoxBefore.Top + groupBoxBefore.Height + GlobalVar.Const_ControlSpacing;
                        }
                    }
                    groupBox        = this.CreateGB(pageNr);
                    groupBox.Top    = topGroupBox;
                    groupBox.Left   = colomnGroupBox * (GlobalVar.Const_GroupBoxWidth + GlobalVar.Const_ControlSpacing) + GlobalVar.Const_ControlSpacing;
                    groupBox.Width  = GlobalVar.Const_GroupBoxWidth;
                    groupBox.Text   = groupName;
                    groupNameBefore = groupName;
                    groupBoxBefore  = groupBox;
                }

                tabPagegheight = this.m_TabControlDaten.Height - this.m_TabControlDaten.ItemSize.Height - 8;
                rest           = tabPagegheight - groupBox.Top - groupBox.Height - GlobalVar.Const_GroupBoxOffsetRest;;
                if (rest < 0)
                {
                    colomnGroupBox++;
                    if (colomnGroupBox > 1)
                    {
                        colomnGroupBox = 0;
                        groupBoxBefore = null;
                        row            = 0;
                        this.CreatePage();
                        pageNr++;
                    }
                    row = 0;

                    topGroupBox     = GlobalVar.Const_ControlSpacing;
                    groupBox        = this.CreateGB(pageNr);
                    groupBox.Top    = topGroupBox;
                    groupBox.Left   = colomnGroupBox * (GlobalVar.Const_GroupBoxWidth + GlobalVar.Const_ControlSpacing) + GlobalVar.Const_ControlSpacing;
                    groupBox.Width  = GlobalVar.Const_GroupBoxWidth;
                    groupBox.Text   = groupName;
                    groupNameBefore = groupName;
                    groupBoxBefore  = groupBox;
                }


                int      ledTop = row * (GlobalVar.Const_LedHeigt + GlobalVar.Const_LedSpacing) + GlobalVar.Const_GroupBoxOffset;
                LedRound led    = this.CreateLED(groupBox);
                led.Type = LEDType.Release;
                led.Name = FuncGeneral.GetControlName(led);
                led.Top  = ledTop;
                led.Left = GlobalVar.Const_ControlSpacing;
                m_glb_DataBinding.AddList(this.Name, led.Name.ToString(), "State", "DB54." + symbolName);
                row++;
                groupBox.Height = row * (GlobalVar.Const_LedHeigt + GlobalVar.Const_LedSpacing) + GlobalVar.Const_GroupBoxOffset + GlobalVar.Const_LedSpacing;

                Label lbl = this.CreateLBL(groupBox);
                lbl.Top    = led.Top;
                lbl.Height = led.Height;
                lbl.Left   = led.Left + led.Width + GlobalVar.Const_ControlSpacing;
                lbl.Width  = GlobalVar.Const_GroupBoxWidth - lbl.Left - GlobalVar.Const_ControlSpacing;
                lbl.Text   = comment;
            }
        }