Esempio n. 1
0
        protected void property_Load()
        {
            try
            {
                string value;

                //폼내용은 '/*폼이름:Top, Left, Width, Height, WindowState*/' 구성
                switch (_configFileType)
                {
                case enConfigFileType.ConfigXml:
                    Function.Setting xml = SavePosition_Setting as Function.Setting;
                    if (xml == null)
                    {
                        value = string.Empty;
                    }
                    else
                    {
                        xml.Group_Select(_xmlSave_GroupName);
                        value = xml.Value_Get(_propertySave_property_name, string.Empty);
                    }
                    break;


                default:
                    value = Fnc.obj2String(Function.DFnc.Property_Get_Value(SavePosition_Setting, _propertySave_property_name));
                    break;
                }



                value = Function.form.fncForm.getSettingString(value, this.Name);
                string[] pp = value.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                Control  c;
                string[] v;

                int idx;

                //컨트롤과 컨트롤 구분은 ';', 컨틀롤내 값사이구분은 '/'
                foreach (string p in pp)
                {
                    try
                    {
                        v = p.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
                        c = Function.form.fncForm.FindControlInControl(this, v[0]);
                        if (c == null)
                        {
                            continue;
                        }

                        switch (c.GetType().ToString())
                        {
                        case "DevExpress.XtraGrid.GridControl":
                            //DevExpress.XtraGrid.GridControl gc = c as DevExpress.XtraGrid.GridControl;
                            //DevExpress.XtraGrid.Views.Grid.GridView gv = (DevExpress.XtraGrid.Views.Grid.GridView)gc.FocusedView;

                            Object         gv   = Function.DFnc.Property_Get_Value(c, "FocusedView");
                            CollectionBase cols = (CollectionBase)Function.DFnc.Property_Get_Value(gv, "Columns");


                            foreach (string cl in v)
                            {
                                string[] pv = cl.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                                if (pv.Length < 2 || !Fnc.isNumeric(pv[1]))
                                {
                                    continue;
                                }

                                //gv.Columns[pv[0]].Width = Fnc.obj2int(pv[1]);

                                object col = Function.DFnc.Property_Get_Value(cols, "Item", new Type[] { typeof(string) }, new object[] { pv[0] });
                                Function.DFnc.Property_Set_Value(col, "Width", Fnc.obj2int(pv[1]));
                            }


                            break;


                        case "DevExpress.XtraEditors.SplitterControl":
                            //DevExpress.XtraEditors.SplitterControl sc = c as DevExpress.XtraEditors.SplitterControl;
                            //sc.SplitPosition = Fnc.obj2int(v[1]);

                            Function.DFnc.Property_Set_Value(c, "SplitPosition", Fnc.obj2int(v[1]));
                            break;

                        case "System.Windows.Forms.SplitContainer":
                            Function.DFnc.Property_Set_Value(c, "SplitterDistance", Fnc.obj2int(v[1]));
                            break;

                        case "System.Windows.Forms.CheckBox":
                            CheckBox cbox = c as CheckBox;
                            cbox.Checked = bool.Parse(v[1]);
                            break;

                        //case "Function.form.usrInputBox":
                        //    Function.form.usrInputBox ib = c as Function.form.usrInputBox;
                        //    ib.Text = v[1];
                        //    break;

                        case "System.Windows.Forms.Panel":
                            Panel pnl = c as Panel;
                            pnl.Width  = Fnc.obj2int(v[1]);
                            pnl.Height = Fnc.obj2int(v[2]);
                            break;

                        case "System.Windows.Forms.Splitter":
                            Splitter sp = c as Splitter;
                            sp.Left = Fnc.obj2int(v[1]);
                            sp.Top  = Fnc.obj2int(v[2]);
                            break;

                        case "System.Windows.Forms.ListView":
                            ListView lst = c as ListView;

                            if (lst.Columns.Count != (v.Length - 1))
                            {
                                return;
                            }

                            idx = 0;

                            foreach (string cl in v)
                            {
                                //첫번째는 이름이므로
                                if (idx == 0)
                                {
                                    idx++;
                                    continue;
                                }

                                try
                                {
                                    string[] pv = cl.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                                    if (pv.Length < 2 || !Fnc.isNumeric(pv[1]) || !Fnc.isNumeric(pv[0]))
                                    {
                                        continue;
                                    }

                                    //gv.Columns[pv[0]].Width = Fnc.obj2int(pv[1]);
                                    lst.Columns[Fnc.obj2int(pv[0])].Width = Fnc.obj2int(pv[1]);
                                }
                                catch
                                {
                                }

                                idx++;
                            }

                            break;

                        case "System.Windows.Forms.DataGridView":
                            System.Windows.Forms.DataGridView dgv = c as System.Windows.Forms.DataGridView;

                            if (dgv.Columns.Count != (v.Length - 1))
                            {
                                return;
                            }

                            idx = 0;

                            foreach (string cl in v)
                            {
                                //첫번째는 이름이므로
                                if (idx == 0)
                                {
                                    idx++;
                                    continue;
                                }

                                try
                                {
                                    string[] pv = cl.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                                    if (pv.Length < 2 || !Fnc.isNumeric(pv[1]) || !Fnc.isNumeric(pv[0]))
                                    {
                                        continue;
                                    }

                                    //gv.Columns[pv[0]].Width = Fnc.obj2int(pv[1]);
                                    dgv.Columns[Fnc.obj2int(pv[0])].Width = Fnc.obj2int(pv[1]);
                                }
                                catch
                                {
                                }

                                idx++;
                            }

                            break;

                        default:
                            try
                            {
                                DFnc.Property_Set_Value(c, "Text", v[1]);
                            }
                            catch { }

                            break;
                        }
                    }
                    catch
                    {
                        continue;
                    }
                }
            }
            catch
            {
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 폼 위치 정보를 저장한다.
        /// </summary>
        protected void formPostion_Save()
        {
            //마지막 창정보를 저장한다.
            if (!_saveposition)
            {
                return;
            }

            try
            {
                string           value;
                Function.Setting xml = null;

                //폼내용은 '/*폼이름:Top, Left, Width, Height, WindowState*/' 구성
                switch (_configFileType)
                {
                case enConfigFileType.ConfigXml:
                    xml = SavePosition_Setting as Function.Setting;
                    if (xml == null)
                    {
                        value = string.Empty;
                    }
                    else
                    {
                        xml.Group_Select(_xmlSave_GroupName);
                        value = xml.Value_Get(_savePosition_PropertyName, string.Empty);
                    }
                    break;


                default:
                    value = Fnc.obj2String(Function.DFnc.Property_Get_Value(SavePosition_Setting, _savePosition_PropertyName));
                    break;
                }

                string formNM = string.Format("/*{0}:", Name.ToUpper());

                value = fncForm.revSettingString(value, Name);

                value += formNM;

                FormWindowState state = WindowState;
                if (this.WindowState != FormWindowState.Normal)
                {
                    this.WindowState = FormWindowState.Normal;
                    this.Visible     = true;
                    Application.DoEvents();
                }

                value += string.Format("{0}:{1}:{2}:{3}:{4}", Top, Left, Width, Height, (int)state);

                value += "*/";

                switch (_configFileType)
                {
                case enConfigFileType.ConfigXml:
                    if (xml != null)
                    {
                        xml.Group_Select(_xmlSave_GroupName);
                        xml.Value_Set(_savePosition_PropertyName, value);
                        xml.Setting_Save();
                    }
                    break;

                default:
                    Function.DFnc.Property_Set_Value(SavePosition_Setting, _savePosition_PropertyName, value);
                    Function.DFnc.Method_Excute(SavePosition_Setting, "Save", null);
                    break;
                }
            }
            catch
            {
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 컨트롤의 프로퍼티 정보를 저장한다.
        /// </summary>
        protected void property_Save()
        {
            if (SavePosition_Setting == null)
            {
                return;
            }

            try
            {
                //폼내용은 '/*폼이름:컨트롤정보들...*/' 구성
                string value;


                Function.Setting xml = null;

                //폼내용은 '/*폼이름:Top, Left, Width, Height, WindowState*/' 구성
                switch (_configFileType)
                {
                case enConfigFileType.ConfigXml:
                    xml = SavePosition_Setting as Function.Setting;
                    if (xml == null)
                    {
                        value = string.Empty;
                    }
                    else
                    {
                        xml.Group_Select(_xmlSave_GroupName);
                        value = xml.Value_Get(_propertySave_property_name, string.Empty);
                    }
                    break;


                default:
                    value = Fnc.obj2String(Function.DFnc.Property_Get_Value(SavePosition_Setting, _propertySave_property_name));
                    break;
                }



                string formNM = string.Format("/*{0}:", this.Name.ToUpper());

                value = Function.form.fncForm.revSettingString(value, this.Name);

                value += formNM;

                string[] pp = _propertySaveContolsName.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                Control  c;
                int      idx;

                //컨트롤과 컨트롤 구분은 ';', 컨틀롤내 값사이구분은 '/'
                foreach (string p in pp)
                {
                    try
                    {
                        c = Function.form.fncForm.FindControlInControl(this, p);
                        if (c == null)
                        {
                            continue;
                        }

                        switch (c.GetType().ToString())
                        {
                        case "DevExpress.XtraGrid.GridControl":
                            //case "DevExpress.XtraGrid.Views.Grid.GridView":
                            //DevExpress.XtraGrid.GridControl gc = c as DevExpress.XtraGrid.GridControl;
                            //DevExpress.XtraGrid.Views.Grid.GridView gv = (DevExpress.XtraGrid.Views.Grid.GridView)gc.FocusedView;

                            Object gv = Function.DFnc.Property_Get_Value(c, "FocusedView");


                            //value += gc.Name + ":";

                            value += Function.DFnc.Property_Get_Value(c, "Name").ToString() + ":";

                            CollectionBase cols = (CollectionBase)Function.DFnc.Property_Get_Value(gv, "Columns");

                            foreach (object col in cols)
                            {
                                //value += string.Format("{0}/{1}:", col.FieldName, col.Width);
                                value += string.Format("{0}/{1}:", Function.DFnc.Property_Get_Value(col, "FieldName"), Function.DFnc.Property_Get_Value(col, "Width"));
                            }
                            value += ";";
                            break;

                        case "DevExpress.XtraEditors.SplitterControl":
                            //DevExpress.XtraEditors.SplitterControl sc = c as DevExpress.XtraEditors.SplitterControl;
                            //value += string.Format("{0}:{1};", sc.Name, sc.SplitPosition);
                            value += string.Format("{0}:{1};", Function.DFnc.Property_Get_Value(c, "Name"), Function.DFnc.Property_Get_Value(c, "SplitPosition"));

                            break;

                        case "System.Windows.Forms.SplitContainer":
                            value += string.Format("{0}:{1};", Function.DFnc.Property_Get_Value(c, "Name"), Function.DFnc.Property_Get_Value(c, "SplitterDistance"));

                            break;


                        case "System.Windows.Forms.CheckBox":
                            CheckBox cbox = c as CheckBox;
                            value += string.Format("{0}:{1};", cbox.Name, cbox.Checked);
                            break;

                        //크기 조정이 splitter로 안됌 -> 판넬 크기 기억으로 처리..
                        //case "System.Windows.Forms.Splitter":
                        //    Splitter sp = c as Splitter;
                        //    value += string.Format("{0}:{1}:{2};", sp.Name, sp.Left, sp.Top);
                        //    break;

                        case "System.Windows.Forms.Panel":
                            Panel pnl = c as Panel;
                            value += string.Format("{0}:{1}:{2};", pnl.Name, pnl.Width, pnl.Height);
                            break;

                        case "System.Windows.Forms.ListView":
                            ListView lst = c as ListView;

                            value += Function.DFnc.Property_Get_Value(c, "Name").ToString() + ":";


                            foreach (ColumnHeader col  in lst.Columns)
                            {
                                //value += string.Format("{0}/{1}:", col.FieldName, col.Width);
                                value += string.Format("{0}/{1}:", col.Index, col.Width);
                            }
                            value += ";";

                            break;

                        case "System.Windows.Forms.DataGridView":
                            System.Windows.Forms.DataGridView dgv = c as System.Windows.Forms.DataGridView;

                            value += Function.DFnc.Property_Get_Value(c, "Name").ToString() + ":";

                            foreach (DataGridViewColumn col in dgv.Columns)
                            {
                                //value += string.Format("{0}/{1}:", col.FieldName, col.Width);
                                value += string.Format("{0}/{1}:", col.Index, col.Width);
                            }
                            value += ";";


                            break;

                        //case "Function.form.usrInputBox":
                        //    Function.form.usrInputBox ib = c as Function.form.usrInputBox;
                        //    value += string.Format("{0}:{1};", ib.Name, ib.Text);
                        //    break;

                        default:
                            try
                            {
                                value += string.Format("{0}:{1};", c.Name, DFnc.Property_Get_Value(c, "Text"));
                            }
                            catch { }

                            break;
                        }
                    }
                    catch
                    {
                        continue;
                    }
                }

                value += "*/";


                switch (_configFileType)
                {
                case enConfigFileType.ConfigXml:
                    if (xml != null)
                    {
                        xml.Group_Select(_xmlSave_GroupName);
                        xml.Value_Set(_propertySave_property_name, value);
                        xml.Setting_Save();
                    }
                    break;

                default:
                    Function.DFnc.Property_Set_Value(SavePosition_Setting, _propertySave_property_name, value);
                    Function.DFnc.Method_Excute(SavePosition_Setting, "Save", null);
                    break;
                }
            }
            catch
            {
            }
        }
Esempio n. 4
0
        private void formPositon_Load()
        {
            if (!_saveposition)
            {
                return;
            }


            try
            {
                string value;

                //폼내용은 '/*폼이름:Top, Left, Width, Height, WindowState*/' 구성
                switch (_configFileType)
                {
                case enConfigFileType.ConfigXml:
                    Function.Setting s = SavePosition_Setting as Function.Setting;
                    if (s == null)
                    {
                        value = string.Empty;
                    }
                    else
                    {
                        s.Group_Select(_xmlSave_GroupName);
                        value = s.Value_Get(_savePosition_PropertyName, string.Empty);
                    }

                    break;

                default:
                    value = Fnc.obj2String(Function.DFnc.Property_Get_Value(SavePosition_Setting, _savePosition_PropertyName));
                    break;
                }

                value = fncForm.getSettingString(value, Name);

                //컨트롤정보는 '컨트롤이름:top:left:너비:높이;' 로구분
                string[] cValue = value.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);

                int Top    = Fnc.obj2int(cValue[0]);
                int Left   = Fnc.obj2int(cValue[1]);
                int Width  = Fnc.obj2int(cValue[2]);
                int Height = Fnc.obj2int(cValue[3]);

                FormWindowState WindowState = (FormWindowState)Fnc.obj2int(cValue[4]);

                if (Width > 100 && Height > 100)
                {
                    this.Width  = Width < 10 ? this.Width : Width;
                    this.Height = Height < 10 ? this.Height : Height;
                }

                this.Top  = Top < 10 ? 500 : Top;
                this.Left = Left < 10 ? 500 : Left;

                this.WindowState = WindowState;
            }
            catch
            {
            }
        }