1
using
System;
2
using
System.Collections.Generic;
3
using
System.ComponentModel;
4
using
System.Data;
5
using
System.Drawing;
6
using
System.Linq;
7
using
System.Text;
8
using
System.Threading;
9
using
System.Windows.Forms;
10
11
namespace
BrowserDemo
12
{
13
public partial class Form8 : Form
14
{
15
public Form8()
16
{
17
InitializeComponent();
18
}
19
20
private void button1_Click(object sender, EventArgs e)
21
{
22
DoWork();
23
}
24
private void DoWork()
25
{
26
Thread t = new Thread(new ThreadStart(this.DoSomething));
27
t.Start();
28
}
29
private void DoSomething()
30
{
31
MessageBox.Show("thread start");
32
}
33
34
private void button2_Click(object sender, EventArgs e)
35
{
36
foreach (var v in typeof(AA).GetFields())
37
{
38
if (v.FieldType.IsEnum == true)
39
{
40
this.comboBox1.Items.Add(v.Name);
41
}
42
}
43
this.comboBox1.SelectedIndex = 1;
44
45
46
}
47
public enum AA
48
{
49
B,
50
C
51
}
52
53
private void button3_Click(object sender, EventArgs e)
54
{
55
56
AA a = AA.B;
57
MessageBox.Show(a.ToString());
58
this.comboBox1.SelectedIndex = this.comboBox1.FindString(a.ToString());
59
}
60
}
61
}
62

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

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

是些小技巧,但每次要用的时候都得google一遍,真的很痛恨自己这一点,怎么记性就不能再好一点,很耽误时间。在这里记录一下吧
本文参考链接:https://www.cnblogs.com/lexus/archive/2008/08/28/1278557.html