Legend:
- Unmodified
- Added
- Removed
-
Common/FormDimensions.cs
r5 r12 1 using System;1 using System; 2 2 using System.Collections.Generic; 3 3 using System.Linq; … … 7 7 using System.Runtime.InteropServices; 8 8 using Microsoft.Win32; 9 10 9 11 10 namespace Common … … 212 211 } 213 212 } 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 } 214 221 215 222 foreach (Control child in control.Controls) … … 240 247 regKey.SetValue("ColWidth" + I.ToString(), (control as DataGridView).Columns[I].Width); 241 248 } 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); 242 256 } 243 257 -
Common/Prompt.cs
r8 r12 3 3 using System.Linq; 4 4 using System.Text; 5 using System.IO; 5 6 using System.Threading.Tasks; 6 7 using System.Drawing; … … 162 163 }; 163 164 confirmation.Click += (sender, e) => { prompt.Close(); }; 164 ListBox listBox = new ListBox() { Left = 50, Top = 44, Width = 400, Height = dataSize, 165 ListBox listBox = new ListBox() 166 { 167 Left = 50, 168 Top = 44, 169 Width = 400, 170 Height = dataSize, 165 171 Anchor = AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Left 166 172 }; … … 248 254 } 249 255 } 256 257 public static class PromptOpenFile 258 { 259 public static bool ShowDialog(string fileName, string fileType, string fileExtension, out string result) 260 { 261 result = fileName; 262 OpenFileDialog openFileDialog = new OpenFileDialog() { Filter = fileType + " (." + fileExtension + ")|*." + 263 fileExtension + "|Any file|*.*", DefaultExt = fileExtension }; 264 if (!string.IsNullOrEmpty(fileName)) 265 { 266 openFileDialog.FileName = Path.GetFileName(fileName); 267 openFileDialog.InitialDirectory = Path.GetDirectoryName(fileName); 268 } 269 270 DialogResult dialogResult = openFileDialog.ShowDialog(); 271 if (dialogResult == DialogResult.OK) 272 { 273 result = openFileDialog.FileName; 274 } 275 return dialogResult == DialogResult.OK; 276 } 277 } 278 279 public static class PromptSaveFile 280 { 281 public static bool ShowDialog(string fileName, string fileType, string fileExtension, out string result) 282 { 283 result = fileName; 284 SaveFileDialog saveFileDialog = new SaveFileDialog() 285 { 286 Filter = fileType + " (." + fileExtension + ")|*." + 287 fileExtension + "|Any file|*.*", 288 DefaultExt = fileExtension 289 }; 290 if (!string.IsNullOrEmpty(fileName)) 291 { 292 saveFileDialog.FileName = Path.GetFileName(fileName); 293 saveFileDialog.InitialDirectory = Path.GetDirectoryName(fileName); 294 } 295 296 DialogResult dialogResult = saveFileDialog.ShowDialog(); 297 if (dialogResult == DialogResult.OK) 298 { 299 result = saveFileDialog.FileName; 300 } 301 return dialogResult == DialogResult.OK; 302 } 303 } 304 305 public static class PromptOpenDir 306 { 307 public static bool ShowDialog(string dirName, out string result) 308 { 309 result = dirName; 310 FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog() { ShowNewFolderButton = true }; 311 if (!string.IsNullOrEmpty(dirName)) 312 folderBrowserDialog.SelectedPath = dirName; 313 DialogResult dialogResult = folderBrowserDialog.ShowDialog(); 314 if (dialogResult == DialogResult.OK) 315 { 316 result = folderBrowserDialog.SelectedPath; 317 } 318 return dialogResult == DialogResult.OK; 319 } 320 } 250 321 } -
Common/Theme.cs
r4 r12 1 using System;1 using System; 2 2 using System.Collections.Generic; 3 3 using System.Linq; … … 7 7 using System.Drawing; 8 8 using System.ComponentModel; 9 using System.IO; 9 10 10 11 namespace Common … … 61 62 } 62 63 64 public static Color AdjustColor(Color color) 65 { 66 if (color == Color.White) color = ColorWindow; 67 else if (color == Color.Black) color = ColorWindowText; 68 else 69 { 70 if (Name == "Dark") 71 { 72 // Exchange dark with light colors and vice versa 73 if (color == Color.DarkBlue) color = Color.LightBlue; 74 if (color == Color.LightBlue) color = Color.DarkBlue; 75 else if (color == Color.DarkGreen) color = Color.LightGreen; 76 else if (color == Color.LightGreen) color = Color.DarkGreen; 77 else if (color == Color.DarkRed) color = Color.LightCoral; 78 else if (color == Color.LightCoral) color = Color.DarkRed; 79 else if (color == Color.PowderBlue) color = Color.Navy; 80 else if (color == Color.Navy) color = Color.PowderBlue; 81 else if (color == Color.LightCyan) color = Color.DarkCyan; 82 else if (color == Color.DarkCyan) color = Color.LightCyan; 83 else if (color == Color.Cyan) color = Color.Teal; 84 else if (color == Color.Teal) color = Color.Cyan; 85 else if (color == Color.Yellow) color = Color.Brown; 86 else if (color == Color.Brown) color = Color.Yellow; 87 else if (color == Color.LightGray) color = Color.DarkGray; 88 else if (color == Color.DarkGray) color = Color.LightGray; 89 } 90 } 91 92 return color; 93 } 94 63 95 public static void ApplyTheme(Component component) 64 96 {
Note:
See TracChangeset
for help on using the changeset viewer.