コード例 #1
0
        void AdjustStationList()
        {
            _isAdjusting = true;
            while (tabControl1.TabCount > 1)
            {
                tabControl1.TabPages.RemoveAt(1);
            }
            _dctStationInfos.Clear();
            JFStationManager mgr = JFHubCenter.Instance.StationMgr;

            string[] stationNames = mgr.AllStationNames();
            if (null == stationNames)
            {
                return;
            }
            foreach (string sn in stationNames)
            {
                TabPage tp = new TabPage(sn);
                tabControl1.TabPages.Add(tp);

                IJFStation  station  = mgr.GetStation(sn);
                RichTextBox rchInfos = new RichTextBox();
                rchInfos.Tag = sn;
                _dctStationInfos.Add(station, rchInfos);
                Button btClear = new Button();
                btClear.Text      = "清空信息";
                btClear.Click    += OnBtStationClear_Click;
                btClear.Tag       = rchInfos;
                btClear.Location  = new Point(tp.Width - 3 - btClear.Width, 3);
                btClear.Anchor    = AnchorStyles.Top | AnchorStyles.Right;
                rchInfos.Location = new Point(3, btClear.Bottom + 3);
                rchInfos.Width    = tp.Width - 6;
                rchInfos.Height   = tp.Height - 3 - rchInfos.Top;
                rchInfos.ReadOnly = true;
                rchInfos.Anchor   = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Left;
                tp.Controls.Add(btClear);
                tp.Controls.Add(rchInfos);
            }

            _isAdjusting = false;
        }