mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
Add items to ListView without creating instance of LvItem.LvSubItem
This commit is contained in:
parent
0baa1c1833
commit
c229d8467f
@ -598,23 +598,11 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
private void Add(Paragraph paragraph)
|
||||
{
|
||||
var item = new ListViewItem(paragraph.Number.ToString(CultureInfo.InvariantCulture)) { Tag = paragraph, UseItemStyleForSubItems = false };
|
||||
ListViewItem.ListViewSubItem subItem;
|
||||
|
||||
subItem = new ListViewItem.ListViewSubItem(item, paragraph.StartTime.ToDisplayString());
|
||||
item.SubItems.Add(subItem);
|
||||
|
||||
subItem = new ListViewItem.ListViewSubItem(item, paragraph.EndTime.ToDisplayString());
|
||||
item.SubItems.Add(subItem);
|
||||
|
||||
subItem = new ListViewItem.ListViewSubItem(item, paragraph.Duration.ToShortDisplayString());
|
||||
item.SubItems.Add(subItem);
|
||||
|
||||
subItem = new ListViewItem.ListViewSubItem(item, paragraph.Text.Replace(Environment.NewLine, _lineSeparatorString));
|
||||
subItem.Font = SubtitleFontBold ?
|
||||
new Font(_subtitleFontName, SubtitleFontSize, FontStyle.Bold) :
|
||||
new Font(_subtitleFontName, SubtitleFontSize);
|
||||
item.SubItems.Add(subItem);
|
||||
|
||||
item.SubItems.Add(paragraph.StartTime.ToDisplayString());
|
||||
item.SubItems.Add(paragraph.EndTime.ToDisplayString());
|
||||
item.SubItems.Add(paragraph.Duration.ToShortDisplayString());
|
||||
item.SubItems.Add(paragraph.Text.Replace(Environment.NewLine, _lineSeparatorString));
|
||||
item.Font = SubtitleFontBold ? new Font(_subtitleFontName, SubtitleFontSize, FontStyle.Bold) : new Font(_subtitleFontName, SubtitleFontSize);
|
||||
Items.Add(item);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user