Esempio n. 1
0
        private void FrmMain_Load(Object sender, EventArgs e)
        {
            txtReceive.UseWinFormControl();

            Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;

            var asmx = AssemblyX.Entry;

            Text += " " + asmx.Compile.ToFullString();

            txtReceive.SetDefaultStyle(12);
            //numCount.SetDefaultStyle(12);

            gbReceive.Tag = gbReceive.Text;

            var cfg = Setting.Current;

            if (cfg.IsNew)
            {
                "代码之巅,天外飞仙!".SpeechTip();
            }

            // 加载保存的颜色
            UIConfig.Apply(txtReceive);

            LoadConfig();
        }
Esempio n. 2
0
        public static UIConfig Apply(TextBoxBase txt)
        {
            // 加载颜色
            var ui = UIConfig.Load();

            if (ui != null)
            {
                try
                {
                    txt.Font      = ui.Font;
                    txt.BackColor = ui.BackColor;
                    txt.ForeColor = ui.ForeColor;
                }
                catch { ui = null; }
            }
            if (ui == null)
            {
                ui           = UIConfig.Current;
                ui.Font      = txt.Font;
                ui.BackColor = txt.BackColor;
                ui.ForeColor = txt.ForeColor;
                ui.Save();
            }

            // 菜单控制
            var menu = txt.ContextMenuStrip;

            if (menu != null)
            {
                var ti = Find(menu.Items, "字体", true);
                if (ti == null)
                {
                    menu.Items.Insert(0, new ToolStripSeparator());

                    ti = new ToolStripMenuItem("字体");
                    menu.Items.Add(ti);
                    ti.Click += mi字体_Click;

                    ti = new ToolStripMenuItem("前景色");
                    menu.Items.Add(ti);
                    ti.Click += mi前景色_Click;

                    ti = new ToolStripMenuItem("背景色");
                    menu.Items.Add(ti);
                    ti.Click += mi背景色_Click;
                }
            }

            return(ui);
        }