예제 #1
0
        private void comBoxType_SelectedIndexChanged(object sender, EventArgs e)
        {
            SettingPair setPair = _configTable[comBoxType.Text];

            _currentSetup = new CSetup(setPair);
            SignalConfigures sigConf = ((CSettings)_currentSetup.Settings).SignConfig;

            sigLen.GAN_LENGTH  = sigConf.GanLength;
            sigLen.XIAN_LENGTH = sigConf.XianLength;
            sigLen.CHE_LENGTH  = sigConf.CheLength;

            picBoxChe = new PictureBox[sigLen.CHE_LENGTH];
            this.carPane.Controls.Clear();
            for (int i = 0; i < sigLen.CHE_LENGTH; i++)
            {
                picBoxChe[i]           = new PictureBox();
                picBoxChe[i].Width     = 20;
                picBoxChe[i].Height    = 20;
                picBoxChe[i].Top       = 0;
                picBoxChe[i].BackColor = Color.DarkSeaGreen;
                picBoxChe[i].Left      = i * 50;
                this.carPane.Controls.Add(picBoxChe[i]);
            }



            picBoxGan = new PictureBox[sigLen.GAN_LENGTH];
            this.ganPane.Controls.Clear();
            for (int i = 0; i < sigLen.GAN_LENGTH; i++)
            {
                picBoxGan[i]           = new PictureBox();
                picBoxGan[i].Width     = 20;
                picBoxGan[i].Height    = 20;
                picBoxGan[i].Top       = 0;
                picBoxGan[i].BackColor = Color.DarkSeaGreen;
                picBoxGan[i].Left      = i * 50;
                picBoxGan[i].Show();

                this.ganPane.Controls.Add(picBoxGan[i]);
            }

            picBoxXian = new PictureBox[sigLen.XIAN_LENGTH];
            this.xianPane.Controls.Clear();
            for (int i = 0; i < sigLen.XIAN_LENGTH; i++)
            {
                picBoxXian[i]           = new PictureBox();
                picBoxXian[i].Width     = 20;
                picBoxXian[i].Height    = 20;
                picBoxXian[i].Top       = 0;
                picBoxXian[i].BackColor = Color.DarkSeaGreen;
                picBoxXian[i].Left      = i * 50;
                picBoxXian[i].Show();

                this.xianPane.Controls.Add(picBoxXian[i]);
            }
        }
예제 #2
0
        private void ExamSetup_Load(object sender, EventArgs e)
        {
            if (_configTable != null)
            {
                _tabTable = new Dictionary <TabItem, CSetup>();
                IDictionaryEnumerator dicEnum = _configTable.GetEnumerator();
                while (dicEnum.MoveNext())
                {
                    DictionaryEntry ent = dicEnum.Entry;

                    TabItem tab = new TabItem();
                    tab.Text   = (string)ent.Key;
                    tab.Click += new EventHandler(tab_Click);

                    SettingPair set  = (SettingPair)ent.Value;
                    CSetup      temp = new CSetup(set);

                    PropertyGrid pg = new PropertyGrid();
                    pg.Dock           = System.Windows.Forms.DockStyle.Fill;
                    pg.SelectedObject = temp.Settings;

                    TabControlPanel tabControlPanel = new TabControlPanel();

                    tab.AttachedControl = tabControlPanel;

                    tabControlPanel.Dock     = System.Windows.Forms.DockStyle.Fill;
                    tabControlPanel.Location = new System.Drawing.Point(0, 26);
                    tabControlPanel.Name     = (string)ent.Key;
                    //tabControlPanel.Padding = new System.Windows.Forms.Padding(1);
                    tabControlPanel.Size = new System.Drawing.Size(409, 440);
                    //tabControlPanel.TabIndex = 1;
                    tabControlPanel.TabItem = tab;

                    tabControlPanel.Controls.Add(pg);

                    tabCtrl.Controls.Add(tabControlPanel);

                    this.tabCtrl.Tabs.Add(tab);

                    _tabTable.Add(tab, temp);
                }

                if (this.tabCtrl.Tabs.Count > 0)
                {
                    _currentSetup = _tabTable[this.tabCtrl.SelectedTab];
                }
            }
        }
예제 #3
0
파일: GXSetup.cs 프로젝트: wpmyj/Zhuangkao
        private void GXQufan_Load(object sender, EventArgs e)
        {
            if (_configTable != null)
            {
                _tabTable = new Dictionary <TabItem, CSetup>();
                IDictionaryEnumerator dicEnum = _configTable.GetEnumerator();
                while (dicEnum.MoveNext())
                {
                    DictionaryEntry ent = dicEnum.Entry;

                    TabItem tab = new TabItem();
                    tab.Text   = (string)ent.Key;
                    tab.Click += new EventHandler(tab_Click);

                    SettingPair set  = (SettingPair)ent.Value;
                    CSetup      temp = new CSetup(set);

                    TabControlPanel tabControlPanel = new TabControlPanel();

                    tab.AttachedControl = tabControlPanel;

                    tabControlPanel.Dock     = System.Windows.Forms.DockStyle.Fill;
                    tabControlPanel.Location = new System.Drawing.Point(0, 26);
                    tabControlPanel.Name     = (string)ent.Key;
                    tabControlPanel.Size     = new System.Drawing.Size(464, 300);
                    tabControlPanel.TabItem  = tab;

                    GroupBox groupBoxGan = new GroupBox();
                    groupBoxGan.Location = new Point(12, 20);
                    groupBoxGan.Size     = new Size(400, 90);
                    groupBoxGan.Text     = "杆信号";
                    GroupBox groupBoxXian = new GroupBox();
                    groupBoxXian.Location = new Point(12, 125);
                    groupBoxXian.Size     = new Size(400, 90);
                    groupBoxXian.Text     = "线信号";

                    CheckBox[] gan;
                    CheckBox[] xian;

                    SignalConfigures tempSigConf = ((CSettings)temp.Settings).SignConfig;

                    gan  = new CheckBox[tempSigConf.GanLength];
                    xian = new CheckBox[tempSigConf.XianLength];

                    int tempGanVal  = 0;
                    int tempXianVal = 0;

                    switch (_type)
                    {
                    case SetupDialogType.QF:
                        this.Text   = "取反";
                        tempGanVal  = tempSigConf.AdminQFGan;
                        tempXianVal = tempSigConf.AdminQFXian;
                        break;

                    case SetupDialogType.PB:
                        this.Text   = "屏蔽";
                        tempGanVal  = tempSigConf.PBGan;
                        tempXianVal = tempSigConf.PBXian;
                        break;

                    case SetupDialogType.ADMIN_PB:
                        this.Text   = "管理员屏蔽";
                        tempGanVal  = tempSigConf.AdminPBGan;
                        tempXianVal = tempSigConf.AdminPBXian;
                        break;
                    }

                    for (int i = 0; i < gan.Length; i++)
                    {
                        gan[i] = new CheckBox();
                        groupBoxGan.Controls.Add(gan[i]);
                        gan[i].AutoSize = true;
                        gan[i].Location = new System.Drawing.Point(43 + i * 32, 38);
                        gan[i].Text     = Convert.ToString(i + 1);
                        gan[i].Size     = new System.Drawing.Size(36, 16);
                        gan[i].UseVisualStyleBackColor = true;
                        gan[i].Click += new System.EventHandler(Gan_Click);
                        if (((tempGanVal >> i) & 1) == 1)
                        {
                            gan[i].Checked = true;
                        }
                        else
                        {
                            gan[i].Checked = false;
                        }
                    }

                    for (int i = 0; i < xian.Length; i++)
                    {
                        xian[i] = new CheckBox();
                        groupBoxXian.Controls.Add(xian[i]);
                        xian[i].AutoSize = true;
                        xian[i].Location = new System.Drawing.Point(43 + i * 32, 38);
                        xian[i].Text     = Convert.ToString(i + 1);
                        xian[i].Size     = new System.Drawing.Size(36, 16);
                        xian[i].UseVisualStyleBackColor = true;
                        xian[i].Click += new System.EventHandler(Xian_Click);
                        if (((tempXianVal >> i) & 1) == 1)
                        {
                            xian[i].Checked = true;
                        }
                        else
                        {
                            xian[i].Checked = false;
                        }
                    }

                    tabControlPanel.Controls.Add(groupBoxGan);
                    tabControlPanel.Controls.Add(groupBoxXian);

                    tabCtrl.Controls.Add(tabControlPanel);

                    this.tabCtrl.Tabs.Add(tab);

                    _tabTable.Add(tab, temp);
                }

                if (this.tabCtrl.Tabs.Count > 0)
                {
                    _currentSetup   = _tabTable[this.tabCtrl.SelectedTab];
                    _currentSigConf = ((CSettings)_currentSetup.Settings).SignConfig;
                }
            }
        }
예제 #4
0
파일: GXSetup.cs 프로젝트: wpmyj/Zhuangkao
 void tab_Click(object sender, EventArgs e)
 {
     _currentSetup   = _tabTable[(TabItem)sender];
     _currentSigConf = ((CSettings)_currentSetup.Settings).SignConfig;
 }
예제 #5
0
 void tab_Click(object sender, EventArgs e)
 {
     _currentSetup = _tabTable[(TabItem)sender];
 }