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:
|
while (this.Visible)
{
this.Invoke((MethodInvoker)delegate
{
Process[] Processes = Process.GetProcesses().Distinct().ToArray();
List<string> Processnames = new List<string>();
for (int i = 0; i < Processes.Length; i++)
{
Processnames.Add(Processes[i].ProcessName);
}
for (int i = 0; i < Controls.Count; i++)
{
if (Processnames.Contains(Path.GetFileNameWithoutExtension(this.Controls[i].Name)))
{
((PictureBox)this.Controls[i]).BorderStyle = BorderStyle.Fixed3D;
}
else
{
((PictureBox)this.Controls[i]).BorderStyle = BorderStyle.None;
}
/*foreach (Control c in this.Controls)
{
if (Path.GetFileNameWithoutExtension(c.Name) == Processes[i].ProcessName)
{
((PictureBox)c).BorderStyle = BorderStyle.Fixed3D;
}
else
{
((PictureBox)c).BorderStyle = BorderStyle.FixedSingle;
}
}*/
}
});
Thread.Sleep(50);
|