forked from ClusterM/hakchi2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SearchForm.cs
41 lines (36 loc) · 1.15 KB
/
SearchForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
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();
}
}
}