コード例 #1
0
        private void AddFileList(FileInfo info)
        {
            ListViewItem item = new ListViewItem(info.Name, _iconListManager.AddFileIcon(info.FullName));

            item.UseItemStyleForSubItems = false;
            item.SubItems.Add(info.Length.ToFileSize());
            item.SubItems.Add(info.LastWriteTime.ToString("yyyy/MM/dd hh:mm:ss tt"));
            item.SubItems.Add(Shell32.GetFileType(info));
            //item.SubItems[0].ForeColor = Color.Blue;
            item.SubItems[1].ForeColor = Color.Gray;
            item.SubItems[2].ForeColor = Color.Gray;
            item.SubItems[3].ForeColor = Color.DarkGray;
            if (listViewFiles.InvokeRequired)
            {
                listViewFiles.Invoke((MethodInvoker) delegate() {
                    listViewFiles.Items.Add(item);
                });
            }
            else
            {
                listViewFiles.Items.Add(item);
            }
            listViewFiles.Invalidate();
        }