Example #1
0
        //окно настройки интерфейса
        private void настройкиИнтерфейсаToolStripMenuItem_Click(object sender, EventArgs e)
        {
            InterfaceOption interfaceOption = new InterfaceOption();

            interfaceOption.Show(this);
        }
Example #2
0
        public MainForm()
        {
            InitializeComponent();
            //Установка формы (при запуске). Иначе - устанавливает серую форму.
            try
            {
                InterfaceOption interfaceOption = new InterfaceOption();
                RegistryKey     txtRedOption    = Registry.CurrentUser;
                RegistryKey     Interface       = txtRedOption.CreateSubKey("Interface");
                switch (Interface.GetValue("Theme").ToString())
                {
                case ("0"):
                    mc  = Color.FromArgb(255, 193, 7);
                    mpc = Color.FromArgb(255, 243, 80);
                    cc  = Color.FromArgb(199, 145, 0);
                    tc  = Color.Black;
                    break;

                case ("1"):
                    mc  = Color.FromArgb(55, 71, 79);
                    mpc = Color.FromArgb(98, 114, 123);
                    cc  = Color.FromArgb(16, 32, 39);
                    tc  = Color.White;
                    break;

                case ("2"):
                    mc  = Color.FromArgb(0, 187, 0);
                    mpc = Color.FromArgb(14, 132, 54);
                    cc  = Color.FromArgb(0, 192, 100);
                    tc  = Color.White;
                    break;

                case ("3"):
                    mc  = Color.White;
                    mpc = Color.White;
                    cc  = Color.White;
                    tc  = Color.Black;
                    break;

                case ("4"):
                    mc  = Color.FromArgb(213, 0, 0);
                    mpc = Color.FromArgb(255, 81, 49);
                    cc  = Color.FromArgb(155, 0, 0);
                    tc  = Color.White;
                    break;
                }
            }
            catch
            {
                InterfaceOption interfaceOption = new InterfaceOption();
                RegistryKey     txtRedOption    = Registry.CurrentUser;
                RegistryKey     Interface       = txtRedOption.CreateSubKey("Interface");
                Interface.SetValue("Theme", "3");
            }
            try
            {
                BackColor = mc;
            }
            catch
            {
                BackColor = Color.Gray;
                foreach (ToolStripComboBox micb
                         in toolStrip1.Items.OfType <ToolStripComboBox>())
                {
                    micb.BackColor = Color.Gray;
                    micb.ForeColor = Color.Black;
                }
                foreach (ToolStripMenuItem micb
                         in menuStrip1.Items.OfType <ToolStripMenuItem>())
                {
                    micb.BackColor = Color.Gray;
                    micb.ForeColor = Color.Black;
                }
            }
            finally
            {
                ForeColor              = tc;
                menuStrip1.BackColor   = cc;
                menuStrip1.ForeColor   = tc;
                statusStrip1.BackColor = cc;
                statusStrip1.ForeColor = tc;
                toolStrip1.BackColor   = mpc;
                toolStrip1.ForeColor   = tc;
                foreach (ToolStripMenuItem MItem
                         in menuStrip1.Items.OfType <ToolStripMenuItem>())
                {
                    MItem.BackColor = cc;
                    MItem.ForeColor = tc;
                    foreach (ToolStripItem TItem
                             in MItem.DropDownItems.OfType <ToolStripItem>())
                    {
                        TItem.BackColor = cc;
                        TItem.ForeColor = tc;
                    }
                    foreach (ToolStripSeparator TSep
                             in MItem.DropDownItems.OfType <ToolStripSeparator>())
                    {
                        TSep.BackColor = cc;
                        TSep.ForeColor = tc;
                    }
                }
            }
        }