コード例 #1
0
        private void KeppySynthMixerWindow_Load(object sender, EventArgs e)
        {
            try
            {
                base.DoubleBuffered = true;
                SetStyle(ControlStyles.AllPaintingInWmPaint, true);
                SetStyle(ControlStyles.ResizeRedraw, true);
                SetStyle(ControlStyles.UserPaint, true);
                SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
                UpdateStyles();

                Delegate = this;
                CPUSpeed();
                if (Channels == null)
                {
                    Registry.CurrentUser.CreateSubKey("SOFTWARE\\Keppy's Synthesizer\\Channels");
                    return;
                }
                if (Convert.ToInt32(Settings.GetValue("volumeboost")) == 1)
                {
                    menuItem5.Checked = true;
                    MeterFunc.SetMaximum(200);
                    for (int i = 0; i <= 16; ++i)
                    {
                        RegValInt[i] = Convert.ToInt32(Channels.GetValue(RegValName[i], 100));
                        if (RegValInt[i] > 200)
                        {
                            RegValInt[i] = 200;
                        }
                    }
                }
                else
                {
                    for (int i = 0; i <= 16; ++i)
                    {
                        RegValInt[i] = Convert.ToInt32(Channels.GetValue(RegValName[i], 100));
                        if (RegValInt[i] > 100)
                        {
                            RegValInt[i] = 100;
                        }
                    }
                }

                CH1VOL.Value  = RegValInt[0];
                CH2VOL.Value  = RegValInt[1];
                CH3VOL.Value  = RegValInt[2];
                CH4VOL.Value  = RegValInt[3];
                CH5VOL.Value  = RegValInt[4];
                CH6VOL.Value  = RegValInt[5];
                CH7VOL.Value  = RegValInt[6];
                CH8VOL.Value  = RegValInt[7];
                CH9VOL.Value  = RegValInt[8];
                CH10VOL.Value = RegValInt[9];
                CH11VOL.Value = RegValInt[10];
                CH12VOL.Value = RegValInt[11];
                CH13VOL.Value = RegValInt[12];
                CH14VOL.Value = RegValInt[13];
                CH15VOL.Value = RegValInt[14];
                CH16VOL.Value = RegValInt[15];
                MainVol.Value = RegValInt[16];

                if (Convert.ToInt32(Settings.GetValue("volumemon")) == 1)
                {
                    VolumeMonitor.Checked = true;
                    MeterFunc.EnableLEDs();
                    VUStatus = true;
                }
                else
                {
                    VolumeMonitor.Checked = false;
                    MeterFunc.DisableLEDs();
                    VUStatus = false;
                }
                ChannelVolume.Enabled = true;
                GarbageCollector.RunWorkerAsync();

                if (Properties.Settings.Default.VolDelay)
                {
                    ReduceDelayVol.Checked = true;
                    VolumeCheck.Interval   = 1;
                }
                else
                {
                    ReduceDelayVol.Checked = false;
                    VolumeCheck.Interval   = 50;
                }

                if (Properties.Settings.Default.CurrentTheme == 0)
                {
                    ClassicTheme.PerformClick();
                }
                else if (Properties.Settings.Default.CurrentTheme == 1)
                {
                    DarkTheme.PerformClick();
                }
                else if (Properties.Settings.Default.CurrentTheme == 2)
                {
                    ItsThe80sTheme.PerformClick();
                }
                else
                {
                    ClassicTheme.PerformClick();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Can not read settings from the registry!\n\nPress OK to quit.\n\n.NET error:\n" + ex.Message.ToString(), "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }