Changeset 5


Ignore:
Timestamp:
Mar 7, 2019, 3:50:35 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Updated common files from projects.
Location:
Common
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • Common/FormDimensions.cs

    r1 r5  
    1313    class FormDimensions
    1414    {
    15         private Form form;
     15        public Form form;
    1616        public string RegSubKey;
    1717        public FormWindowState defaultFormWindowState = FormWindowState.Normal;
     
    200200                          (control as ListView).Columns[I].Width = (int) regKey.GetValue("ColWidth" + I.ToString());
    201201                }
     202            } else
     203            if (control is DataGridView)
     204            {
     205                RegistryKey regKey = Application.UserAppDataRegistry.OpenSubKey(RegSubKey + "\\" + form.Name + "\\" + control.Name, true);
     206                if (regKey == null) regKey = Application.UserAppDataRegistry.CreateSubKey(RegSubKey + "\\" + form.Name + "\\" + control.Name);
     207
     208                for (int I = 0; I < (control as DataGridView).Columns.Count; I++)
     209                {
     210                    if (regKey.GetValue("ColWidth" + I.ToString()) != null)
     211                        (control as DataGridView).Columns[I].Width = (int)regKey.GetValue("ColWidth" + I.ToString());
     212                }
    202213            }
    203214
     
    218229                {
    219230                    regKey.SetValue("ColWidth" + I.ToString(), (control as ListView).Columns[I].Width);
     231                }
     232            } else
     233            if (control is DataGridView)
     234            {
     235                RegistryKey regKey = Application.UserAppDataRegistry.OpenSubKey(RegSubKey + "\\" + form.Name + "\\" + control.Name, true);
     236                if (regKey == null) regKey = Application.UserAppDataRegistry.CreateSubKey(RegSubKey + "\\" + form.Name + "\\" + control.Name);
     237
     238                for (int I = 0; I < (control as DataGridView).Columns.Count; I++)
     239                {
     240                    regKey.SetValue("ColWidth" + I.ToString(), (control as DataGridView).Columns[I].Width);
    220241                }
    221242            }
  • Common/SuspendDrawing.cs

    r1 r5  
    1616        public static void Suspend(Control parent)
    1717        {
    18             SendMessage(parent.Handle, WM_SETREDRAW, false, 0);
     18            if (parent.Visible) SendMessage(parent.Handle, WM_SETREDRAW, false, 0);
    1919        }
    2020
    2121        public static void Resume(Control parent)
    2222        {
    23             SendMessage(parent.Handle, WM_SETREDRAW, true, 0);
     23            if (parent.Visible) SendMessage(parent.Handle, WM_SETREDRAW, true, 0);
    2424            parent.Refresh();
    2525        }
Note: See TracChangeset for help on using the changeset viewer.