- Timestamp:
- Feb 21, 2019, 2:13:01 PM (6 years ago)
- Location:
- Common
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/FormFind.Designer.cs
r2 r3 35 35 this.checkBoxMatchCase = new System.Windows.Forms.CheckBox(); 36 36 this.buttonFindPrevious = new System.Windows.Forms.Button(); 37 this.comboBoxWhat = new System.Windows.Forms.ComboBox();37 this.comboBoxWhat = new Common.ComboBoxEx(); 38 38 this.SuspendLayout(); 39 39 // … … 154 154 private System.Windows.Forms.CheckBox checkBoxMatchCase; 155 155 private System.Windows.Forms.Button buttonFindPrevious; 156 private System.Windows.Forms.ComboBox comboBoxWhat;156 private Common.ComboBoxEx comboBoxWhat; 157 157 } 158 158 } -
Common/FormFind.cs
r2 r3 16 16 public RichTextBoxEx richTextBox; 17 17 public string regSubKey; 18 public int maxHistoryCount;19 18 20 19 public FormFind() … … 22 21 InitializeComponent(); 23 22 regSubKey = "Find"; 24 maxHistoryCount = 20;25 23 } 26 24 … … 60 58 private void SearchText(bool reverse = false) 61 59 { 62 if (comboBoxWhat.Text.Trim() != "") 63 { 64 string previousText = comboBoxWhat.Text; 65 int index = comboBoxWhat.Items.IndexOf(comboBoxWhat.Text); 66 if (index >= 0) comboBoxWhat.Items.RemoveAt(index); 67 comboBoxWhat.Text = previousText; 68 comboBoxWhat.Items.Insert(0, comboBoxWhat.Text); 69 70 while (comboBoxWhat.Items.Count > maxHistoryCount) 71 comboBoxWhat.Items.RemoveAt(comboBoxWhat.Items.Count - 1); 72 } 60 comboBoxWhat.UpdateHistory(); 73 61 74 62 while (true) … … 111 99 new FormDimensions().Load(this, Owner); 112 100 comboBoxWhat.Focus(); 101 comboBoxWhat.regSubKey = regSubKey + "\\History"; 113 102 LoadFromRegistry(); 114 103 UpdateInterface(); … … 153 142 checkBoxMatchCase.Checked = regKey.GetValueBool("MatchCase", false); 154 143 155 regKey = Application.UserAppDataRegistry.OpenSubKey(regSubKey + "\\History"); 156 if (regKey == null) regKey = Application.UserAppDataRegistry.CreateSubKey(regSubKey + "\\History"); 157 int count = regKey.GetValueInt("Count", 0); 158 comboBoxWhat.BeginUpdate(); 159 while (comboBoxWhat.Items.Count > count) comboBoxWhat.Items.RemoveAt(comboBoxWhat.Items.Count - 1); 160 while (comboBoxWhat.Items.Count < count) comboBoxWhat.Items.Add(""); 161 for (int i = 0; i < count; i++) 162 { 163 comboBoxWhat.Items[i] = (string)regKey.GetValue(i.ToString(), ""); 164 } 165 comboBoxWhat.EndUpdate(); 144 comboBoxWhat.LoadFromRegistry(); 166 145 } 167 146 … … 171 150 if (regKey == null) regKey = Application.UserAppDataRegistry.CreateSubKey(regSubKey); 172 151 152 173 153 regKey.SetValue("MatchWholeWordOnly", checkBoxMatchWholeWordOnly.Checked); 174 154 regKey.SetValue("MatchCase", checkBoxMatchCase.Checked); 175 155 176 regKey = Application.UserAppDataRegistry.OpenSubKey(regSubKey + "\\History", true); 177 if (regKey == null) regKey = Application.UserAppDataRegistry.CreateSubKey(regSubKey + "\\History"); 178 179 int i = 0; 180 regKey.SetValue("Count", comboBoxWhat.Items.Count); 181 foreach (var item in comboBoxWhat.Items) 182 { 183 regKey.SetValue(i.ToString(), item); 184 i++; 185 } 186 187 while (true) 188 { 189 List<string> names = regKey.GetValueNames().ToList(); 190 if (names.IndexOf(i.ToString()) != -1) 191 { 192 regKey.DeleteValue(i.ToString()); 193 } 194 else break; 195 i++; 196 } 156 comboBoxWhat.SaveToRegistry(); 197 157 } 198 158 } -
Common/Theme.cs
r1 r3 12 12 public class Theme 13 13 { 14 public delegate void ApplyThemeHandler(Component component); 15 static public event ApplyThemeHandler OnApplyTheme = null; 14 16 static public Color ColorWindow; 15 17 static public Color ColorWindowText; … … 95 97 (component as LinkLabel).VisitedLinkColor = ColorControlText; 96 98 } else 97 if (component is TabControl) 99 if (component is TabControl) 98 100 { 99 101 foreach (TabPage tabPage in (component as TabControl).TabPages) … … 132 134 (component as DataGridView).ColumnHeadersDefaultCellStyle.BackColor = ColorWindow; 133 135 (component as DataGridView).ColumnHeadersDefaultCellStyle.ForeColor = ColorWindowText; 134 } 136 } else 137 if (component is RichTextBox) 138 { 139 (component as RichTextBox).SelectAll(); 140 (component as RichTextBox).SelectionColor = ColorWindowText; 141 (component as RichTextBox).SelectionLength = 0; 142 } else 143 144 OnApplyTheme(component); 135 145 } 136 146
Note:
See TracChangeset
for help on using the changeset viewer.