Esempio n. 1
0
        private void button_AddOutputIo_Click(object sender, EventArgs e)
        {
            int  intVerticalScroll = 0;
            bool blnScroll         = false;

            if (intOutputControlCount >= StationManage.intStationIoOutPutCount)
            {
                MessageBoxLog.Show("工位可配输出IO已达最大");
                return;
            }
            if (intOutputControlCount < 1)
            {
                IOOutputSetLabelControl iooutlb = new IOOutputSetLabelControl();
                panel_OutputIo.Controls.Add(iooutlb);
                iooutlb.Location = new Point(3, 1);
            }
            if (_StationM.arrOutputIo.Count == intOutputControlCount)
            {
                _StationM.arrOutputIo.Add(new IOParameter());
            }
            else
            {
                if (intInputControlCount >= 0)
                {
                    _StationM.arrOutputIo[intInputControlCount] = new IOParameter();
                }
            }

            if (panel_OutputIo.VerticalScroll.Value > 0)
            {
                intVerticalScroll = panel_InputIo.VerticalScroll.Value;
                panel_OutputIo.VerticalScroll.Value = panel_OutputIo.VerticalScroll.Minimum;
                blnScroll = true;
            }
            IOSetPanelControl setC = new IOSetPanelControl();

            panel_OutputIo.Controls.Add((Control)setC);
            setC.Location = new Point(3, 27 + intOutputControlCount * setC.Height + intOutputControlCount * 5);
            setC.IO       = _StationM.arrOutputIo[intOutputControlCount];
            intOutputControlCount++;

            if (blnScroll)
            {
                panel_OutputIo.AutoScrollPosition = new Point(panel_OutputIo.HorizontalScroll.Value, intVerticalScroll);
            }
        }
Esempio n. 2
0
        public void InitForm()
        {
            try
            {
                int i = 0;
                if (_StationM != null && !string.IsNullOrEmpty(_StationM.strStationName))
                {
                    for (i = 0; i < intAxisControlCount; i++)
                    {
                        if (i == 0)
                        {
                            AxisSetLabelControl axisL = new AxisSetLabelControl();
                            panel_Axis.Controls.Add(axisL);
                            axisL.Location = new Point(42, 5);
                        }
                        AxisSetConfigControl setC = new AxisSetConfigControl();
                        panel_Axis.Controls.Add((Control)setC);
                        setC.Location = new Point(3, 32 + i * setC.Height + i * 5);
                        setC.AxisSet  = _StationM.arrAxis[i];

                        cboAxisName.Items.Add(_StationM.arrAxis[i].AxisName);
                    }
                    if (cboAxisName.Items.Count > 0)
                    {
                        cboAxisName.SelectedIndex = 0;
                    }
                    for (i = 0; i < intInputControlCount; i++)
                    {
                        if (i == 0)
                        {
                            IOInputSetLabelControl ioinlab = new IOInputSetLabelControl();
                            panel_InputIo.Controls.Add(ioinlab);
                            ioinlab.Location = new Point(3, 1);
                        }
                        IOSetPanelControl inputIo = new IOSetPanelControl();
                        panel_InputIo.Controls.Add((Control)inputIo);
                        inputIo.Location = new Point(3, 27 + i * inputIo.Height + i * 5);
                        inputIo.IO       = _StationM.arrInputIo[i];
                    }
                    for (i = 0; i < intOutputControlCount; i++)
                    {
                        if (i == 0)
                        {
                            IOOutputSetLabelControl iooutlb = new IOOutputSetLabelControl();
                            panel_OutputIo.Controls.Add(iooutlb);
                            iooutlb.Location = new Point(3, 1);
                        }
                        IOSetPanelControl outputIo = new IOSetPanelControl();
                        panel_OutputIo.Controls.Add((Control)outputIo);
                        outputIo.Location = new Point(3, 27 + i * outputIo.Height + i * 5);
                        outputIo.IO       = _StationM.arrOutputIo[i];
                    }

                    int m = 0;
                    for (i = 0; i < intPointControlCount; i++)
                    {
                        if (i == 0)
                        {
                            PointLabel = new PointDetailedSetUILabelControl(_StationM, intAxisControlCount);
                            panel_Point.Controls.Add((Control)PointLabel);
                            PointLabel.Location = new Point(85, 18);
                        }


                        if (_StationM.arrPoint[i].tag_BeginPointAggregateList != null)
                        {
                            foreach (PointAggregate pa in _StationM.arrPoint[i].tag_BeginPointAggregateList)
                            {
                                if (IsAdd(pa) == true)
                                {
                                    PointSetControl setP = new PointSetControl();
                                    panel_Point.Controls.Add((Control)setP);
                                    setP.Location       = new Point(17, 53 + (m) * setP.Height + m * 5);
                                    setP.intAxisCount   = intAxisControlCount;
                                    setP.PointAggregate = pa;
                                    tag_PointAggregateList.Add(pa);
                                    m++;
                                }
                            }
                        }
                        if (IsAdd(_StationM.arrPoint[i]) == true)
                        {
                            PointSetControl setP1 = new PointSetControl();
                            panel_Point.Controls.Add((Control)setP1);
                            setP1.Location       = new Point(17, 53 + (m) * setP1.Height + m * 5);
                            setP1.intAxisCount   = intAxisControlCount;
                            setP1.PointAggregate = _StationM.arrPoint[i];
                            tag_PointAggregateList.Add(_StationM.arrPoint[i]);
                            m++;
                        }
                        if (_StationM.arrPoint[i].tag_EndPointAggregateList != null)
                        {
                            foreach (PointAggregate pa in _StationM.arrPoint[i].tag_EndPointAggregateList)
                            {
                                if (IsAdd(pa) == true)
                                {
                                    PointSetControl setP = new PointSetControl();
                                    panel_Point.Controls.Add((Control)setP);
                                    setP.Location       = new Point(17, 53 + (m) * setP.Height + m * 5);
                                    setP.intAxisCount   = intAxisControlCount;
                                    setP.PointAggregate = pa;
                                    tag_PointAggregateList.Add(pa);
                                    m++;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception mess)
            {
                LogOutControl.OutLog(mess.Message, 0);
            }
        }