主题:等高手 帮忙改写下代码
private: System::Void Form1_Load(System::Object * sender, System::EventArgs * e)
{
columnHeader1 = new ColumnHeader();
columnHeader2 = new ColumnHeader();
columnHeader3 = new ColumnHeader();
columnHeader4 = new ColumnHeader();
columnHeader5 = new ColumnHeader();
columnHeader6 = new ColumnHeader();
columnHeader7 = new ColumnHeader();
ColumnHeader* col[] = new ColumnHeader*[7];
col[0] = columnHeader1;
col[1] = columnHeader2;
col[2] = columnHeader3;
col[3] = columnHeader4;
col[4] = columnHeader5;
col[5] = columnHeader6;
col[6] = columnHeader7;
listView1->Columns->AddRange(col);
String * strTmp[] = new String *[7];
ListViewItem *item1 = new ListViewItem(strTmp);
ListViewItem *item2 = new ListViewItem(strTmp);
ListViewItem* item[] = new ListViewItem*[2];
item[0] = item1;
item[1] = item2;
listView1->Items->AddRange(item);
}
private: System::Void button1_Click(System::Object * sender, System::EventArgs * e)
{
String * strTmp[] = new String *[7];
strTmp[0] = textBox1->Text;
strTmp[1] = textBox2->Text;
strTmp[2] = textBox3->Text;
ListViewItem *item1 = new ListViewItem(strTmp);
ListViewItem *i[] = new ListViewItem* [1];
i[0] = item1;
listView1->Items->AddRange(i);
}
一个托管的 listview 我想实现添加 项 , 但每次生成程序后添加总是从第3行开始的 怎么让他从第一行添加??
{
columnHeader1 = new ColumnHeader();
columnHeader2 = new ColumnHeader();
columnHeader3 = new ColumnHeader();
columnHeader4 = new ColumnHeader();
columnHeader5 = new ColumnHeader();
columnHeader6 = new ColumnHeader();
columnHeader7 = new ColumnHeader();
ColumnHeader* col[] = new ColumnHeader*[7];
col[0] = columnHeader1;
col[1] = columnHeader2;
col[2] = columnHeader3;
col[3] = columnHeader4;
col[4] = columnHeader5;
col[5] = columnHeader6;
col[6] = columnHeader7;
listView1->Columns->AddRange(col);
String * strTmp[] = new String *[7];
ListViewItem *item1 = new ListViewItem(strTmp);
ListViewItem *item2 = new ListViewItem(strTmp);
ListViewItem* item[] = new ListViewItem*[2];
item[0] = item1;
item[1] = item2;
listView1->Items->AddRange(item);
}
private: System::Void button1_Click(System::Object * sender, System::EventArgs * e)
{
String * strTmp[] = new String *[7];
strTmp[0] = textBox1->Text;
strTmp[1] = textBox2->Text;
strTmp[2] = textBox3->Text;
ListViewItem *item1 = new ListViewItem(strTmp);
ListViewItem *i[] = new ListViewItem* [1];
i[0] = item1;
listView1->Items->AddRange(i);
}
一个托管的 listview 我想实现添加 项 , 但每次生成程序后添加总是从第3行开始的 怎么让他从第一行添加??