public int FileProcesser() { Stream FileStream = OpenFile(); if (FileStream == null) { MessageBox.Show("文件打开失败!", "警告"); } else { MessageBox.Show("文件打开成功!", "提示"); //FileHeaderListView FileHeaderListView.Items.Clear(); FileHeaderListView.BeginUpdate(); byte[] buffer = new byte[2]; FileStream.Seek(0, SeekOrigin.Begin); FileStream.Read(buffer, 0, buffer.Length); string value = BitConverter.ToString(buffer).Replace("-", string.Empty).ToUpper(); FileHeaderListViewItemAdd("MZ头", value); FileHeaderListView.EndUpdate(); //xxxxxxxxxx FileStream.Close(); } return(0); }
public int ListViewUpdate() { FileHeaderListView.Items.Clear(); FileHeaderListView.BeginUpdate(); for (int i = 0; i < 10; i++) { ListViewItem FileHeaderListViewItem = new ListViewItem(); FileHeaderListViewItem.Text = "1"; FileHeaderListViewItem.SubItems.Add("第2列,第" + i + "行"); this.FileHeaderListView.Items.Add(FileHeaderListViewItem); } MessageBox.Show("7777"); FileHeaderListView.EndUpdate(); return(0); }