Example #1
0
        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;
            }
        }