public override void OnLoad() { try { ReAddItem(); txtName.Text = TrainManager.SetTrainNameAuto(TrainManager.TrainDatas[cbType.SelectedIndex]); } catch (Exception ex) { RTCore.Environment.ReportError(ex, AccessManager.AccessKey); } }
public TrainAdd_NameType_Page(Page old, Train _t = null) { try { InitializeComponent(); AddControl(this); OldPage = old; t = _t; Title = TextManager.Get().Text("addtrain"); IconImg = Image.FromStream(ResourceManager.Get($".\\data\\res\\{OptionManager.Get().ResFolder}\\images.npk", "ico_timetable.png", 5, 7, 1, 6)); imgAdd = Image.FromStream(ResourceManager.Get($".\\data\\res\\{OptionManager.Get().ResFolder}\\images.npk", "btn_add.png", 5, 7, 1, 6)); imgAddSel = Image.FromStream(ResourceManager.Get($".\\data\\res\\{OptionManager.Get().ResFolder}\\images.npk", "btn_add_sel.png", 5, 7, 1, 6)); lbBack.ForeColor = ResourceManager.Get("trainadd.back.unsel"); lbBack.SelColor = ResourceManager.Get("trainadd.back.sel"); lbBack.Font = new Font(RTCore.Environment.Font, 20); lbBack.Text = TextManager.Get().Text("back"); lbBack.Location = new Point(25, 553); lbAdd.ForeColor = ResourceManager.Get("trainadd.add.unsel"); lbAdd.SelColor = ResourceManager.Get("trainadd.add.sel"); lbAdd.Font = new Font(RTCore.Environment.Font, 20); lbAdd.Text = TextManager.Get().Text("buy"); lbAdd.Location = new Point(Width - 25 - lbAdd.Width, 553); txtName.Text = "txtName"; cbType.SelectedIndexChanged += delegate { txtName.Text = TrainManager.SetTrainNameAuto(TrainManager.TrainDatas[cbType.SelectedIndex]); GameManager.LastSelectTrainData = cbType.SelectedIndex; }; cbType.Name = "cbType"; cbType.Font = new Font(RTCore.Environment.Font, 20); cbType.Size = new Size(455, cbType.Height); ReAddItem(); cbType.DropDownStyle = ComboBoxStyle.DropDownList; cbType.Location = new Point((Width / 2) - 250, (Height / 2) - 75); Controls.Add(cbType); txtName.Font = new Font(RTCore.Environment.Font, 20); txtName.Size = new Size(500, txtName.Height); txtName.Location = new Point(cbType.Location.X, cbType.Location.Y + cbType.Height + 80); txtName.MaxLength = 40; Controls.Add(txtName); pbDataAdd.Name = "pbDataAdd"; pbDataAdd.Location = new Point(cbType.Location.X + cbType.Width + 10, cbType.Location.Y); pbDataAdd.Size = new Size(cbType.Height, cbType.Height); pbDataAdd.SizeMode = PictureBoxSizeMode.StretchImage; pbDataAdd.Image = imgAdd; pbDataAdd.MouseEnter += delegate { pbDataAdd.Image = imgAddSel; }; pbDataAdd.MouseLeave += delegate { pbDataAdd.Image = imgAdd; }; pbDataAdd.Click += delegate { PageManager.SetPage(new TrainDataAdd_Name_Page(this), AccessManager.AccessKey); }; Controls.Add(pbDataAdd); lbInfo.Font = new Font(RTCore.Environment.Font, 12); lbInfo.Location = new Point(txtName.Location.X, txtName.Location.Y + txtName.Height + 7); SetTextInfo(); cbType.SelectedIndexChanged += delegate { SetTextInfo(); }; picDataIcon.Location = new Point(Width - (Width - (txtName.Width + txtName.Location.X)) - 100, txtName.Location.Y + txtName.Height + 5); } catch (Exception ex) { RTCore.Environment.ReportError(ex, AccessManager.AccessKey); } }