Changeset 14 for Common/FormDimensions.cs
- Timestamp:
- Aug 2, 2022, 11:46:25 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/FormDimensions.cs
r12 r14 1 1 using System; 2 using System.Collections.Generic;3 using System.Linq;4 using System.Text;5 2 using System.Drawing; 6 3 using System.Windows.Forms; … … 12 9 class FormDimensions 13 10 { 14 public Form form;11 public Form Form; 15 12 public string RegSubKey; 16 public FormWindowState defaultFormWindowState = FormWindowState.Normal;13 public FormWindowState DefaultFormWindowState = FormWindowState.Normal; 17 14 18 15 [DllImport("user32.dll")] … … 73 70 public void Load(Form form, Form parentForm = null) 74 71 { 75 this. form = form;72 this.Form = form; 76 73 RegistryKey regKey = Application.UserAppDataRegistry.OpenSubKey(RegSubKey + "\\" + form.Name); 77 74 if (regKey == null) regKey = Application.UserAppDataRegistry.CreateSubKey(RegSubKey + "\\" + form.Name); … … 103 100 (int)regKey.GetValue("RestoreBoundsWidth" + name, restoreBounds.Width), 104 101 (int)regKey.GetValue("RestoreBoundsHeight" + name, restoreBounds.Height)); 105 FormWindowState windowState = (FormWindowState)regKey.GetValue("State" + name, (int) defaultFormWindowState);102 FormWindowState windowState = (FormWindowState)regKey.GetValue("State" + name, (int)DefaultFormWindowState); 106 103 if (parentForm != null) 107 104 { … … 150 147 public void Save(Form form, Form parentForm = null) 151 148 { 152 this. form = form;149 this.Form = form; 153 150 RegistryKey regKey = Application.UserAppDataRegistry.OpenSubKey(RegSubKey + "\\" + form.Name, true); 154 151 if (regKey == null) regKey = Application.UserAppDataRegistry.CreateSubKey(RegSubKey + "\\" + form.Name); … … 191 188 if (control is ListView) 192 189 { 193 RegistryKey regKey = Application.UserAppDataRegistry.OpenSubKey(RegSubKey + "\\" + form.Name + "\\" + control.Name, true);194 if (regKey == null) regKey = Application.UserAppDataRegistry.CreateSubKey(RegSubKey + "\\" + form.Name + "\\" + control.Name);190 RegistryKey regKey = Application.UserAppDataRegistry.OpenSubKey(RegSubKey + "\\" + Form.Name + "\\" + control.Name, true); 191 if (regKey == null) regKey = Application.UserAppDataRegistry.CreateSubKey(RegSubKey + "\\" + Form.Name + "\\" + control.Name); 195 192 196 193 for (int I = 0; I < (control as ListView).Columns.Count; I++) … … 202 199 if (control is DataGridView) 203 200 { 204 RegistryKey regKey = Application.UserAppDataRegistry.OpenSubKey(RegSubKey + "\\" + form.Name + "\\" + control.Name, true);205 if (regKey == null) regKey = Application.UserAppDataRegistry.CreateSubKey(RegSubKey + "\\" + form.Name + "\\" + control.Name);201 RegistryKey regKey = Application.UserAppDataRegistry.OpenSubKey(RegSubKey + "\\" + Form.Name + "\\" + control.Name, true); 202 if (regKey == null) regKey = Application.UserAppDataRegistry.CreateSubKey(RegSubKey + "\\" + Form.Name + "\\" + control.Name); 206 203 207 204 for (int I = 0; I < (control as DataGridView).Columns.Count; I++) … … 213 210 if (control is SplitContainer) 214 211 { 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);212 RegistryKey regKey = Application.UserAppDataRegistry.OpenSubKey(RegSubKey + "\\" + Form.Name + "\\" + control.Name, true); 213 if (regKey == null) regKey = Application.UserAppDataRegistry.CreateSubKey(RegSubKey + "\\" + Form.Name + "\\" + control.Name); 217 214 218 215 if (regKey.GetValue("SplitterDistance") != null) … … 230 227 if (control is ListView) 231 228 { 232 RegistryKey regKey = Application.UserAppDataRegistry.OpenSubKey(RegSubKey + "\\" + form.Name + "\\" + control.Name, true);233 if (regKey == null) regKey = Application.UserAppDataRegistry.CreateSubKey(RegSubKey + "\\" + form.Name + "\\" + control.Name);229 RegistryKey regKey = Application.UserAppDataRegistry.OpenSubKey(RegSubKey + "\\" + Form.Name + "\\" + control.Name, true); 230 if (regKey == null) regKey = Application.UserAppDataRegistry.CreateSubKey(RegSubKey + "\\" + Form.Name + "\\" + control.Name); 234 231 235 232 for (int I = 0; I < (control as ListView).Columns.Count; I++) … … 240 237 if (control is DataGridView) 241 238 { 242 RegistryKey regKey = Application.UserAppDataRegistry.OpenSubKey(RegSubKey + "\\" + form.Name + "\\" + control.Name, true);243 if (regKey == null) regKey = Application.UserAppDataRegistry.CreateSubKey(RegSubKey + "\\" + form.Name + "\\" + control.Name);239 RegistryKey regKey = Application.UserAppDataRegistry.OpenSubKey(RegSubKey + "\\" + Form.Name + "\\" + control.Name, true); 240 if (regKey == null) regKey = Application.UserAppDataRegistry.CreateSubKey(RegSubKey + "\\" + Form.Name + "\\" + control.Name); 244 241 245 242 for (int I = 0; I < (control as DataGridView).Columns.Count; I++) … … 250 247 if (control is SplitContainer) 251 248 { 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);249 RegistryKey regKey = Application.UserAppDataRegistry.OpenSubKey(RegSubKey + "\\" + Form.Name + "\\" + control.Name, true); 250 if (regKey == null) regKey = Application.UserAppDataRegistry.CreateSubKey(RegSubKey + "\\" + Form.Name + "\\" + control.Name); 254 251 255 252 regKey.SetValue("SplitterDistance", (control as SplitContainer).SplitterDistance);
Note:
See TracChangeset
for help on using the changeset viewer.