Ignore:
Timestamp:
Mar 14, 2020, 1:11:28 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved classes.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Common/FormDimensions.cs

    r5 r12  
    1 using System;
     1using System;
    22using System.Collections.Generic;
    33using System.Linq;
     
    77using System.Runtime.InteropServices;
    88using Microsoft.Win32;
    9 
    109
    1110namespace Common
     
    212211                }
    213212            }
     213            if (control is SplitContainer)
     214            {
     215                RegistryKey regKey = Application.UserAppDataRegistry.OpenSubKey(RegSubKey + "\\" + form.Name + "\\" + control.Name, true);
     216                if (regKey == null) regKey = Application.UserAppDataRegistry.CreateSubKey(RegSubKey + "\\" + form.Name + "\\" + control.Name);
     217
     218                if (regKey.GetValue("SplitterDistance") != null)
     219                    (control as SplitContainer).SplitterDistance = (int)regKey.GetValue("SplitterDistance");
     220            }
    214221
    215222            foreach (Control child in control.Controls)
     
    240247                    regKey.SetValue("ColWidth" + I.ToString(), (control as DataGridView).Columns[I].Width);
    241248                }
     249            }
     250            if (control is SplitContainer)
     251            {
     252                RegistryKey regKey = Application.UserAppDataRegistry.OpenSubKey(RegSubKey + "\\" + form.Name + "\\" + control.Name, true);
     253                if (regKey == null) regKey = Application.UserAppDataRegistry.CreateSubKey(RegSubKey + "\\" + form.Name + "\\" + control.Name);
     254
     255                regKey.SetValue("SplitterDistance", (control as SplitContainer).SplitterDistance);
    242256            }
    243257
Note: See TracChangeset for help on using the changeset viewer.