Esempio n. 1
0
        //--------------------------------------------------------------------------------------
        public bool PrefLoad()
        {
            bool ret = false;
            //設定ファイルの保存
            JsonPref pref = new JsonPref();

            if (pref.Load() == true)
            {
                bool  ok = false;
                Point p  = pref.GetPoint("Point", out ok);
                if (ok)
                {
                    this.Location = p;
                }
                int h = pref.GetInt("Height", out ok);
                if (ok)
                {
                    this.Height = h;
                }
                int[] a = pref.GetIntArray("ParamsInt", out ok);
                if (ok)
                {
                    tsGrid1.tsd.ParamsInt = a;
                }
                bool[] b = pref.GetBoolArray("ParamsBool", out ok);
                if (ok)
                {
                    tsGrid1.tsd.ParamsBool = b;
                }
                int[] c = pref.GetIntArray("Colors", out ok);
                if (ok)
                {
                    tsGrid1.cols.ColorInt = c;
                }
                int[] d = pref.GetIntArray("Keys", out ok);
                if (ok)
                {
                    tsGrid1.funcs.FuncTableAll = d;
                }
                ret = true;
            }
            return(ret);
        }
Esempio n. 2
0
        //-------------------------------------------------------------
        /// <summary>
        /// フォーム作成時に呼ばれる
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form1_Load(object sender, EventArgs e)
        {
            string pp = "";

            //設定ファイルの読み込み
            JsonPref pref = new JsonPref();

            if (pref.Load())
            {
                bool ok = false;
                //Size sz = pref.GetSize("Size", out ok);
                //if (ok) this.Size = sz;
                Point p = pref.GetPoint("Point", out ok);
                if (ok)
                {
                    this.Location = p;
                }

                Size sz = pref.GetSize("ButtonSize", out ok);
                if (ok)
                {
                    iconButtonList1.ButtonSize = sz;
                }

                int[] cols = pref.GetIntArray("Color", out ok);
                if (ok)
                {
                    if (cols.Length >= 2)
                    {
                        iconButtonList1.ForeColor = Color.FromArgb(cols[0]);
                        iconButtonList1.BackColor = Color.FromArgb(cols[1]);
                    }
                }
                bool b = pref.GetBool("RelativePath", out ok);
                if (ok)
                {
                    iconButtonList1.RelativePath = b;
                }


                string ss = pref.GetString("TargetDir", out ok);
                if (ok)
                {
                    if (Directory.Exists(ss) == true)
                    {
                        pp = ss;
                    }
                }
                Font      f   = iconButtonList1.Font;
                string    fn  = f.Name;
                float     fsz = f.Size;
                FontStyle sty = f.Style;


                ss = pref.GetString("Font", out ok);
                if (ok)
                {
                    fn = ss;
                }
                double dd = pref.GetDouble("FontSize", out ok);
                if (ok)
                {
                    fsz = (float)dd;
                }
                int vv = pref.GetInt("FontStyle", out ok);
                if (ok)
                {
                    sty = (FontStyle)vv;
                }

                iconButtonList1.Font = new Font(fn, fsz, sty);
            }
            iconButtonList1.ChkJsxTemplate();


            string[] cmds = System.Environment.GetCommandLineArgs();
            if (cmds.Length > 1)
            {
                AnalysisCommand(cmds);
                pp = "";
            }

            if (pp != "")
            {
                iconButtonList1.TargetDir = pp;
                this.Text = iconButtonList1.MenuName;
            }
            else
            {
                this.Text = Path.GetFileNameWithoutExtension(Application.ExecutablePath);
            }
        }