Exemplo n.º 1
0
        // Funkce pro najiti vsech ListView na formu. iAction=0 Save, iAction=1 Load.
        private static void IterateControl(Control.ControlCollection ctrControls, FormActions iAction, string sFormPrefix)
        {
            foreach (Control ctrControl in ctrControls)
            {
                if (ctrControl.Controls.Count > 0)
                {
                    IterateControl(ctrControl.Controls, iAction, sFormPrefix);
                }

                // Pokud je to listviw, prolezeme jeho columny a ulozime
                if (ctrControl.GetType().ToString() == "System.Windows.Forms.ListView")
                {
                    ListView lsvListView = (ListView)ctrControl;

                    foreach (ColumnHeader colColumn in lsvListView.Columns)
                    {
                        // Pokud se jedna o Load, tak nacteme, jinak ulozime
                        if (iAction == FormActions.FormActionLoad)
                        {
                            //MessageBox.Show(sFormPrefix + "_" + lsvListView.Name + "_column" + colColumn.Index.ToString() + " = " + regKeySize.GetValue(sFormPrefix + "_" + lsvListView.Name + "_column" + colColumn.Index.ToString(), "80"));
                            //MessageBox.Show(Convert.ToString(Convert.ToInt32(regKeySize.GetValue(sFormPrefix + "_" + lsvListView.Name + "_column" + colColumn.Index.ToString(), "80"))));
                            //colColumn.Width = Convert.ToInt32(regKeySize.GetValue(sFormPrefix + "_" + lsvListView.Name + "_column" + colColumn.Index.ToString(), "80"));
                            colColumn.Width = Convert.ToInt32(INIFiles.INI_GetSetting("Size", sFormPrefix + "_" + lsvListView.Name + "_column" + colColumn.Index.ToString(), "80"));
                        }
                        else
                        {
                            // Ukladame
                            //regKeySize.SetValue(sFormPrefix + "_" + lsvListView.Name + "_column" + colColumn.Index.ToString(), colColumn.Width.ToString());
                            INIFiles.INI_SetSetting("Size", sFormPrefix + "_" + lsvListView.Name + "_column" + colColumn.Index.ToString(), colColumn.Width.ToString());
                        }
                    }
                }
                else if (ctrControl.GetType().ToString() == "System.Windows.Forms.SplitContainer")
                {
                    // Pretypujeme objekt na spravny
                    SplitContainer scSplit = (SplitContainer)ctrControl;

                    if (iAction == FormActions.FormActionLoad)
                    {
                        scSplit.SplitterDistance = Convert.ToInt32(INIFiles.INI_GetSetting("Size", sFormPrefix + "_" + scSplit.Name + "_distance", "20"));
                    }
                    else
                    {
                        INIFiles.INI_SetSetting("Size", sFormPrefix + "_" + scSplit.Name + "_distance", scSplit.SplitterDistance.ToString());
                    }
                }
            }
        }
Exemplo n.º 2
0
        // Funkce pro ukladani pozic oken
        public static void FormSettingSave(Form frmForm)
        {
            // Pokud je okno minimalizovany, tak neukladame
            if (frmForm.WindowState != FormWindowState.Minimized && frmForm.Visible)
            {
                // Ulozeni pozice okna
                INIFiles.INI_SetSetting("Size", frmForm.Name + "Top", frmForm.Top.ToString());
                INIFiles.INI_SetSetting("Size", frmForm.Name + "Left", frmForm.Left.ToString());

                if (frmForm.FormBorderStyle == FormBorderStyle.Sizable || frmForm.FormBorderStyle == FormBorderStyle.SizableToolWindow)
                {
                    INIFiles.INI_SetSetting("Size", frmForm.Name + "Width", frmForm.Width.ToString());
                    INIFiles.INI_SetSetting("Size", frmForm.Name + "Height", frmForm.Height.ToString());
                }

                IterateControl(frmForm.Controls, FormActions.FormActionSave, frmForm.Name);
            }
        }
Exemplo n.º 3
0
 // Ulozeni hodnoty do registru
 public static void UpdateKey(string sKey, string sValue)
 {
     INIFiles.INI_SetSetting("General", sKey, sValue);
 }