質問編集履歴
1
ソースコードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -50,3 +50,74 @@
|
|
50
50
|
|
51
51
|
|
52
52
|
|
53
|
+
|
54
|
+
### 該当のソースコード
|
55
|
+
|
56
|
+
|
57
|
+
namespace Listview_csvvvvv
|
58
|
+
{
|
59
|
+
public partial class Form1 : Form
|
60
|
+
{
|
61
|
+
public object sfd { get; private set; }
|
62
|
+
public int i { get; private set; }
|
63
|
+
|
64
|
+
public Form1()
|
65
|
+
{
|
66
|
+
InitializeComponent();
|
67
|
+
}
|
68
|
+
|
69
|
+
private void Form1_Load(object sender, EventArgs e)
|
70
|
+
{
|
71
|
+
|
72
|
+
}
|
73
|
+
|
74
|
+
private void listView1_DrawSubItem(object sender,
|
75
|
+
DrawListViewSubItemEventArgs e)
|
76
|
+
{
|
77
|
+
|
78
|
+
}
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
public void btnAdd_Click(object sender, EventArgs e)
|
83
|
+
{
|
84
|
+
if (string.IsNullOrEmpty(txtName.Text) || string.IsNullOrEmpty(txtGender.Text) || string.IsNullOrEmpty(txtAge.Text) || string.IsNullOrEmpty(txtBirthplace.Text) || string.IsNullOrEmpty(txtHobby.Text))
|
85
|
+
return;
|
86
|
+
ListViewItem item = new ListViewItem(txtName.Text);
|
87
|
+
item.SubItems.Add(txtGender.Text);
|
88
|
+
item.SubItems.Add(txtAge.Text);
|
89
|
+
item.SubItems.Add(txtBirthplace.Text);
|
90
|
+
item.SubItems.Add(txtHobby.Text);
|
91
|
+
listView1.Items.Add(item);
|
92
|
+
txtName.Clear();
|
93
|
+
txtGender.Clear();
|
94
|
+
txtAge.Clear();
|
95
|
+
txtBirthplace.Clear();
|
96
|
+
txtHobby.Clear();
|
97
|
+
|
98
|
+
//setListColor();//背景色を帰るのを呼び出してる
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
}
|
103
|
+
/*private void setListColor() //背景色 交互にならんん
|
104
|
+
{
|
105
|
+
for (int i = 0; i < listView1.Items.Count; i++)
|
106
|
+
{
|
107
|
+
ListViewItem item = listView1.Items[i];
|
108
|
+
if (listView1.Items.Count % 2 == 0)
|
109
|
+
{
|
110
|
+
item.BackColor = Color.White;
|
111
|
+
}
|
112
|
+
else
|
113
|
+
{
|
114
|
+
item.BackColor = Color.LightCyan;
|
115
|
+
}
|
116
|
+
}
|
117
|
+
}*/
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|