public void EditThumb(ImageListViewItem item) { string filePath = item.FilePath; if (VideoThumbEditor.CheckExtension(filePath)) { if (mVideoThumbEditor == null) mVideoThumbEditor = new VideoThumbEditor(mForm); mVideoThumbEditor.EditThumb(item); } else if (ArchiveThumbEditor.CheckExtension(filePath)) { if (mArchiveThumbEditor == null) mArchiveThumbEditor = new ArchiveThumbEditor(mForm); mArchiveThumbEditor.EditThumb(item); } }
public GalleryForm() { InitializeComponent(); mToolTip = new ToolTip(); mTagCounter = new Dictionary<string, int>(); mThumbEditor = new ThumbEditor(this); mAdaptor = new GalleryAdaptor(); mFilter = new ImageListViewFilter(imageListView1, mAdaptor); // Setup the background worker Application.Idle += new EventHandler(Application_Idle); mWorker = new BackgroundWorker(); mWorker.DoWork += new DoWorkEventHandler(bw_DoWork); mWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(bw_RunWorkerCompleted); // Find and add built-in renderers Assembly assembly = Assembly.GetAssembly(typeof(ImageListView)); int i = 0; foreach (Type type in assembly.GetTypes()) { if (type.BaseType == typeof(ImageListView.ImageListViewRenderer)) { renderertoolStripComboBox.Items.Add(new RendererComboBoxItem(type)); if (type.Name == "DefaultRenderer") renderertoolStripComboBox.SelectedIndex = i; i++; } } // Find and add custom colors Type colorType = typeof(ImageListViewColor); i = 0; foreach (PropertyInfo field in colorType.GetProperties(BindingFlags.Public | BindingFlags.Static)) { colorToolStripComboBox.Items.Add(new ColorComboBoxItem(field)); if (field.Name == "Default") colorToolStripComboBox.SelectedIndex = i; i++; } // Dynamically add aligment values foreach (object o in Enum.GetValues(typeof(ContentAlignment))) { ToolStripMenuItem item1 = new ToolStripMenuItem(o.ToString()); item1.Tag = o; item1.Click += new EventHandler(checkboxAlignmentToolStripButton_Click); checkboxAlignmentToolStripMenuItem.DropDownItems.Add(item1); ToolStripMenuItem item2 = new ToolStripMenuItem(o.ToString()); item2.Tag = o; item2.Click += new EventHandler(iconAlignmentToolStripButton_Click); iconAlignmentToolStripMenuItem.DropDownItems.Add(item2); } #region imageListView1 initialization imageListView1.AllowDuplicateFileNames = true; imageListView1.Renderer = renderer; imageListView1.SortColumn = 0; imageListView1.SortOrder = SortOrder.AscendingNatural; imageListView1.ContextMenuStrip = contextMenuStrip1; imageListView1.ThumbnailSize = new Size(200, 200); //imageListView1.Columns.Add(ColumnType.Name); int width = imageListView1.Width; int w1 = 300, w2 = 200, w3 = 135, w4 = 86, w5 = 95; imageListView1.Columns.Add(ColumnType.Title, w1); imageListView1.Columns.Add(ColumnType.Artist, w2); imageListView1.Columns.Add(ColumnType.DateCreated, w3); imageListView1.Columns.Add(ColumnType.Rating, w4); imageListView1.Columns.Add(ColumnType.FileSize, w5); imageListView1.Columns.Add(ColumnType.Description, width - w1 - w2 - w3 - w4 - w5); Image errorThumb = new Bitmap(145, 200); using (var g = Graphics.FromImage(errorThumb)) { LinearGradientBrush b = new LinearGradientBrush( new Point(0, 0), new Point(145, 200), Color.FromArgb(255, 255, 255, 255), Color.FromArgb(255, 200, 200, 200)); g.FillRectangle(b, 0, 0, 145, 200); } imageListView1.ErrorImage = errorThumb; #endregion GalleryUtility.SetConfigFileName("config.xml"); InitializeTreeViews(); mComicViewerProgramPath = GalleryUtility.GetSetting("ComicViewer"); mMediaPlayerProgramPath = GalleryUtility.GetSetting("MeidaPlayer"); mWebBrowserProgramPath = GalleryUtility.GetSetting("WebBrowser"); WindowState = System.Windows.Forms.FormWindowState.Maximized; sortToolStripComboBox.SelectedIndex = 1; imageListView1.Focus(); }