public FrmMain() { InitializeComponent(); if (ckbActiveAward.Checked) { timer1.Enabled = true; } else { timer1.Enabled = false; } if (checkBox1.Checked) { this.TopMost = true; } else { this.TopMost = false; } this.systemConfig = SystemConfig.ReadConfig(); frmShow = FrmShow.Create(); frmShow.VisibleChanged += new EventHandler(frmShow_VisibleChanged); frmShow.LotteryCompleted = new FrmShow.LotteryCompeletedDelegate(FrmShow_LotteryCompeleted); TabPageUpdateMap = new Hashtable(); TabPageUpdateMap.Add(tpShow, null); TabPageUpdateMap.Add(tpEmployeeList, ctrlEmployeeList1); TabPageUpdateMap.Add(tpPrizewinnerList, ctrlPrizewinnerList1); TabPageUpdateMap.Add(tpAward, ctrlAward1); TabPageUpdateMap.Add(tpSetting, ctrlSetting1); TabPageUpdateMap.Add(tpDetail, ctrlDetail1); BindGroup(); BindAward(); LoadSetting(); UpdateStateData(false, true,false); tabControl1.SelectedTab = tpShow; }
private void LoadConfig() { SystemConfig systemConfig = SystemConfig.ReadConfig(); bool hcenter = systemConfig.Hcenter; int twidth = this.Width; if (File.Exists(systemConfig.BackgroundImage)) { this.BackgroundImageLayout = ImageLayout.Stretch; BackgroundImage = Image.FromFile(systemConfig.BackgroundImage); } else { } if (!timer.Enabled) { timer.Interval = systemConfig.Speed; } TitleConfig titleConfig = TitleConfig.ReadConfig(); SubtitleConfig subtitleConfig = SubtitleConfig.ReadConfig(); lblSubtitle.Visible = subtitleConfig.Visible; if (lblSubtitle.Visible) { lblSubtitle.Font = subtitleConfig.Font; lblSubtitle.ForeColor = subtitleConfig.Color; lblSubtitle.Location = subtitleConfig.Location; if (hcenter) { lblSubtitle.Left = (twidth - lblSubtitle.Width) / 2; } } ScrollTextConfig scrollTextConfig = ScrollTextConfig.ReadConfig(); LotteryButtonConfig lotteryButtonConfig = LotteryButtonConfig.ReadConfig(); btnLottery.Visible = lotteryButtonConfig.Visible; if (btnLottery.Visible) { btnLottery.Font = lotteryButtonConfig.Font; btnLottery.ForeColor = lotteryButtonConfig.Color; btnLottery.Size = lotteryButtonConfig.Size; btnLottery.Location = lotteryButtonConfig.Location; if (hcenter) { btnLottery.Left = (twidth - btnLottery.Width) / 2; } } LotteryBoxConfig lotteryBoxConfig = LotteryBoxConfig.ReadConfig(); lblLotteryBox.Font = lotteryBoxConfig.Font; lblLotteryBox.ForeColor = lotteryBoxConfig.Color; lblLotteryBox.Location = lotteryBoxConfig.Location; if (hcenter) { lblLotteryBox.AutoSize = false; lblLotteryBox.Left = 0; lblLotteryBox.Width = twidth; } }