blob: 5acf6988be59a2bd172fc14b793229d1393caf53 (
plain)
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
42
43
|
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.listViewGames.Items.Count; i++)
if ((mainForm.listViewGames.Items[i].Tag as NesMiniApplication).Name.
ToLower().StartsWith(textBoxSearch.Text.ToLower()))
{
for (int j = 1; j < mainForm.listViewGames.Items.Count; j++)
mainForm.listViewGames.Items[j].Selected = i == j;
mainForm.listViewGames.EnsureVisible(i);
break;
}
}
}
private void SearchForm_Deactivate(object sender, EventArgs e)
{
Close();
}
private void SearchForm_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape || e.KeyCode == Keys.Enter)
Close();
}
}
}
|