Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-01-15 00:02:00 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-01-15 00:02:00 +0300
commit56e2ae861ebe30866ad1acd95ee2e7cca0219e83 (patch)
tree9a91b8e3e09e3a4d4119027c8780888fb8af4e31 /SearchForm.cs
parentb95a2527632a20078c6f26f30b07c864119a0588 (diff)
Search by first letters
Diffstat (limited to 'SearchForm.cs')
-rw-r--r--SearchForm.cs47
1 files changed, 47 insertions, 0 deletions
diff --git a/SearchForm.cs b/SearchForm.cs
new file mode 100644
index 00000000..096ce643
--- /dev/null
+++ b/SearchForm.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+namespace com.clusterrr.hakchi_gui
+{
+ public partial class SearchForm : Form
+ {
+ MainForm mainForm;
+
+ public SearchForm(MainForm mainForm)
+ {
+ InitializeComponent();
+ this.mainForm = mainForm;
+ }
+
+ private void textBoxSearch_TextChanged(object sender, EventArgs e)
+ {
+ if (textBoxSearch.Text.Length > 0)
+ {
+ for (int i = 1; i < mainForm.checkedListBoxGames.Items.Count; i++)
+ if ((mainForm.checkedListBoxGames.Items[i] as NesGame).Name.
+ ToLower().StartsWith(textBoxSearch.Text.ToLower()))
+ {
+ mainForm.checkedListBoxGames.SelectedIndex = i;
+ break;
+ }
+ }
+ }
+
+ private void SearchForm_Deactivate(object sender, EventArgs e)
+ {
+ Close();
+ }
+
+ private void SearchForm_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.KeyCode == Keys.Escape)
+ Close();
+ }
+ }
+}