public void SetError(Template template, ErrorEventArgs args) { this.lblFile.Text = args.File.FullName; this.lblMessage.Text = args.Message; this.ltvFragment.Columns.Add("Line #", 60, HorizontalAlignment.Left); foreach (Column column in (List <Column>)template.Columns) { string text = Column.ToString(column.ColumnType); if (column.ColumnFormat != "") { text = text + " (" + column.ColumnFormat + ")"; } this.ltvFragment.Columns.Add(text, 100, HorizontalAlignment.Center); } ListViewItem listViewItem = new ListViewItem(args.Row.ToString()); listViewItem.UseItemStyleForSubItems = false; string[] strArray = args.Line.Split((char[])template.CSVOptions.Separator); for (int index = 0; index < strArray.Length; ++index) { listViewItem.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = strArray[index], BackColor = index == args.Column ? Color.Red : listViewItem.BackColor }); } this.ltvFragment.Items.Add(listViewItem); }
public ColumnMenuItem(ColumnType columnType, string columnFormat, ToolStripItem[] subItems, EventHandler handler) { this.ColumnType = columnType; this.ColumnFormat = columnFormat; if (subItems != null) { this.DropDownItems.AddRange(subItems); } this.Text = columnFormat == "" ? Column.ToString(columnType) : columnFormat; if (handler == null) { return; } this.Click += handler; }