public void EditThumb(ImageListViewItem item) { mItem = item; var videoInfo = GetVideoDetails(mItem.FilePath); mDuration = (double)videoInfo[ColumnType.Duration]; mWidth = (int)videoInfo[ColumnType.Width]; mHeight = (int)videoInfo[ColumnType.Width]; thumbSampler.Value = 0; thumbDurationLabel.Text = GalleryUtility.SecondsToTime((int)mDuration); string thumbName = ThumbUtility.GetThumbPath(mItem.FilePath); if (item.ThumbnailCacheState == CacheState.Cached) { thumbViewer.Image = (Image)mItem.ThumbnailImage; } else if (File.Exists(thumbName)) { using (Image img = Image.FromFile(thumbName)) thumbViewer.Image = new Bitmap(img); } else { MessageBox.Show("Thumbnail \"" + thumbName + "\" doesn't exist."); } CenterToScreen(); Show(mParent); mParent.Enabled = false; }
private void PopulateListView(DirectoryInfo dirPath)//, Func<FileInfo, Object> comp) { var infoList = dirPath.GetFiles("*.*").OrderByDescending(x => x.CreationTime); imageListView1.Items.Clear(); imageListView1.SuspendLayout(); foreach (FileInfo info in infoList) { if (ArchiveThumbEditor.CheckExtension(info.Name) || VideoThumbEditor.CheckExtension(info.Name)) { ImageListViewItem item = new ImageListViewItem(info.FullName, Path.GetFileNameWithoutExtension(info.Name) + info.Name.ToUpperInvariant()); imageListView1.Items.Add(item, mAdaptor); } } imageListView1.ResumeLayout(); mFilter.Snapshot(); }
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 void EditThumb(ImageListViewItem item) { if (File.Exists(item.FilePath)) { long fileSize = new FileInfo(item.FilePath).Length; if (fileSize > mLargeFileThreshold) { DialogResult res = MessageBox.Show("This is a large file (" + fileSize / 1024 / 1024 / 1024 + "GB) and takes time to be decompressed. Continue?", "Confirm going on", MessageBoxButtons.YesNo); if (res == DialogResult.No) return; } if (item.ThumbnailCacheState == CacheState.Cached) { thumbViewer.Image = (Image)item.ThumbnailImage; } else { thumbViewer.Image = null; } mItem = item; this.Text = item.FilePath; CenterToScreen(); Show(mParent); mParent.Enabled = false; ProgressDialog progress = new ProgressDialog("Extracting files...", ListArchiveContent); progress.ShowDialog(); string[] fileNameList = (string[])progress.GetResult(); if (fileNameList != null) { archiveViewer.Items.AddRange(fileNameList); } else { CloseEditor(); } progress.Dispose(); } else { MessageBox.Show("File " + item.FilePath + " does not exists!"); } }
public override void DrawItem(Graphics g, ImageListViewItem item, ItemState state, Rectangle bounds) { base.DrawItem(g, item, state, bounds); PhotoInfo p = item.Tag as PhotoInfo; if (ImageListView.View != View.Details && p != null && p.Flickr.Uploaded != null) { // Draw the image Image img = item.ThumbnailImage; if (img != null) { Size itemPadding = new Size(4, 4); Rectangle pos = GetSizedImageBounds(img, new Rectangle(bounds.Location + itemPadding, ImageListView.ThumbnailSize)); Image overlayImage = Resource1.Uploaded; int w = Math.Min(overlayImage.Width, pos.Width); int h = Math.Min(overlayImage.Height, pos.Height); g.DrawImage(overlayImage, pos.Left, pos.Bottom - h, w, h); } } }
/// <summary> /// Draws the specified item on the given graphics. /// </summary> /// <param name="g">The System.Drawing.Graphics to draw on.</param> /// <param name="item">The ImageListViewItem to draw.</param> /// <param name="state">The current view state of item.</param> /// <param name="bounds">The bounding rectangle of item in client coordinates.</param> public override void DrawItem(Graphics g, ImageListViewItem item, ItemState state, Rectangle bounds) { if (item.Index == mImageListView.layoutManager.FirstPartiallyVisible || item.Index == mImageListView.layoutManager.LastPartiallyVisible) { using (Brush b = new HatchBrush(HatchStyle.BackwardDiagonal, Color.Green, Color.Transparent)) { g.FillRectangle(b, bounds); } } if (item.Index == mImageListView.layoutManager.FirstVisible || item.Index == mImageListView.layoutManager.LastVisible) { using (Brush b = new HatchBrush(HatchStyle.ForwardDiagonal, Color.Red, Color.Transparent)) { g.FillRectangle(b, bounds); } } base.DrawItem(g, item, state, bounds); }
/// <summary> /// Draws the specified item on the given graphics. /// </summary> /// <param name="g">The System.Drawing.Graphics to draw on.</param> /// <param name="item">The ImageListViewItem to draw.</param> /// <param name="state">The current view state of item.</param> /// <param name="bounds">The bounding rectangle of item in client coordinates.</param> public override void DrawItem(System.Drawing.Graphics g, ImageListViewItem item, ItemState state, System.Drawing.Rectangle bounds) { // Paint background using (Brush bItemBack = new SolidBrush(item.BackColor)) { g.FillRectangle(bItemBack, bounds); } if (ImageListView.View != Manina.Windows.Forms.View.Details) { Size itemPadding = new Size(4, 4); // Draw the image Image img = item.ThumbnailImage; if (img != null) { Rectangle border = new Rectangle(bounds.Location + itemPadding, ImageListView.ThumbnailSize); Rectangle pos = Utility.GetSizedImageBounds(img, border); g.DrawImage(img, pos); // Draw image border if (ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None)) { using (Pen pen = new Pen(SystemColors.Highlight, 3)) { g.DrawRectangle(pen, border); } } else if (!ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None)) { using (Pen pen = new Pen(SystemColors.GrayText, 3)) { pen.Alignment = PenAlignment.Center; g.DrawRectangle(pen, border); } } else { using (Pen pGray128 = new Pen(Color.FromArgb(128, SystemColors.GrayText))) { g.DrawRectangle(pGray128, border); } } } // Draw item text SizeF szt = TextRenderer.MeasureText(item.Text, ImageListView.Font); RectangleF rt; using (StringFormat sf = new StringFormat()) { rt = new RectangleF(bounds.Left + itemPadding.Width, bounds.Top + 3 * itemPadding.Height + ImageListView.ThumbnailSize.Height, ImageListView.ThumbnailSize.Width, szt.Height); sf.Alignment = StringAlignment.Center; sf.FormatFlags = StringFormatFlags.NoWrap; sf.LineAlignment = StringAlignment.Center; sf.Trimming = StringTrimming.EllipsisCharacter; rt.Width += 1; rt.Inflate(1, 2); if (ImageListView.Focused && ((state & ItemState.Focused) != ItemState.None)) rt.Inflate(-1, -1); if (ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None)) { g.FillRectangle(SystemBrushes.Highlight, rt); } else if (!ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None)) { g.FillRectangle(SystemBrushes.GrayText, rt); } if (((state & ItemState.Selected) != ItemState.None)) { g.DrawString(item.Text, ImageListView.Font, SystemBrushes.HighlightText, rt, sf); } else { using (Brush bItemFore = new SolidBrush(item.ForeColor)) { g.DrawString(item.Text, ImageListView.Font, bItemFore, rt, sf); } } } if (ImageListView.Focused && ((state & ItemState.Focused) != ItemState.None)) { Rectangle fRect = Rectangle.Round(rt); fRect.Inflate(1, 1); ControlPaint.DrawFocusRectangle(g, fRect); } } else { if (ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None)) { g.FillRectangle(SystemBrushes.Highlight, bounds); } else if (!ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None)) { g.FillRectangle(SystemBrushes.GrayText, bounds); } Size offset = new Size(2, (bounds.Height - ImageListView.Font.Height) / 2); using (StringFormat sf = new StringFormat()) { sf.FormatFlags = StringFormatFlags.NoWrap; sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Center; sf.Trimming = StringTrimming.EllipsisCharacter; // Sub text List<ImageListView.ImageListViewColumnHeader> uicolumns = ImageListView.Columns.GetDisplayedColumns(); RectangleF rt = new RectangleF(bounds.Left + offset.Width, bounds.Top + offset.Height, uicolumns[0].Width - 2 * offset.Width, bounds.Height - 2 * offset.Height); foreach (ImageListView.ImageListViewColumnHeader column in uicolumns) { rt.Width = column.Width - 2 * offset.Width; using (Brush bItemFore = new SolidBrush(item.ForeColor)) { if ((state & ItemState.Selected) == ItemState.None) g.DrawString(item.GetSubItemText(column.Type), ImageListView.Font, bItemFore, rt, sf); else g.DrawString(item.GetSubItemText(column.Type), ImageListView.Font, SystemBrushes.HighlightText, rt, sf); } rt.X += column.Width; } } if (ImageListView.Focused && ((state & ItemState.Focused) != ItemState.None)) ControlPaint.DrawFocusRectangle(g, bounds); } }
/// <summary> /// Initializes a new instance of the ItemEventArgs class. /// </summary> /// <param name="item">The currently hovered item.</param> /// <param name="previousItem">The previously hovered item.</param> public ItemHoverEventArgs(ImageListViewItem item, ImageListViewItem previousItem) { mItem = item; mPreviousItem = previousItem; }
/// <summary> /// Raises the DropFiles event. /// </summary> /// <param name="e">A DropFileEventArgs that contains event data.</param> protected virtual void OnDropFiles(DropFileEventArgs e) { if (DropFiles != null) DropFiles(this, e); if (e.Cancel) return; int index = e.Index; int firstItemIndex = 0; mSelectedItems.Clear(false); // Add items bool first = true; foreach (string filename in e.FileNames) { ImageListViewItem item = new ImageListViewItem(filename); if (first || MultiSelect) { item.mSelected = true; first = false; } bool inserted = mItems.InsertInternal(index, item, defaultAdaptor); if (firstItemIndex == 0) firstItemIndex = item.Index; if (inserted) index++; } EnsureVisible(firstItemIndex); OnSelectionChangedInternal(); }
/// <summary> /// Determines whether the item is highlighted. /// </summary> public ItemHighlightState HighlightState(ImageListViewItem item) { bool highlighted = false; if (highlightedItems.TryGetValue(item, out highlighted)) { if (highlighted) return ItemHighlightState.HighlightedAndSelected; else return ItemHighlightState.HighlightedAndUnSelected; } return ItemHighlightState.NotHighlighted; }
/// <summary> /// Updates item details. /// This method is invoked from the item cache thread. /// </summary> internal void UpdateItemDetailsInternal(ImageListViewItem item, Utility.ShellImageFileInfo info) { item.UpdateDetailsInternal(info); }
private void ShowSaved() { imageListView1.ShowCheckBoxes = false; var db = new SqLiteDatabase(); var query = "SELECT * FROM arts_" + _seriesId; try { var dt = db.GetDataTable(query); imageListView1.Items.Clear(); for (var i = 0; i < dt.Rows.Count; i++) { DataRow drow = dt.Rows[i]; var img1 = new ImageListViewItem {FileName = @drow["image"].ToString()}; imageListView1.Items.AddRange(new[] { img1 }); } } catch(Exception e){ Console.WriteLine(e.Message); var createTable = "CREATE TABLE " + "arts_" + _seriesId + "(" + "_id" + " INTEGER PRIMARY KEY," + "image" + " TEXT" + ")"; var adb = new ArtsDatabaseEntry( "res/" + _seriesName + "_banner.jpg"); var adb2 = new ArtsDatabaseEntry("res/" + _seriesName + "_poster.jpg"); var adb3 = new ArtsDatabaseEntry( "res/" + _seriesName + "_fanart.jpg"); try { db.CreateTable(createTable); db.InsertArts(adb, "arts_" + _seriesId); db.InsertArts(adb2, "arts_" + _seriesId); db.InsertArts(adb3, "arts_" + _seriesId); ShowSaved(); } catch (Exception crap) { MessageBox.Show(crap.Message); } } }
/// <summary> /// Initializes a new instance of the ThumbnailCachingEventArgs class. /// </summary> /// <param name="item">The item that is the target of this event.</param> /// <param name="size">The size of the thumbnail request.</param> public ThumbnailCachingEventArgs(ImageListViewItem item, Size size) { Item = item; Size = size; }
/// <summary> /// Initializes a new instance of the ItemEventArgs class. /// </summary> /// <param name="item">The item that is the target of this event.</param> public ItemEventArgs(ImageListViewItem item) { Item = item; }
/// <summary> /// Initializes a new instance of the ItemClickEventArgs class. /// </summary> /// <param name="item">The item that is the target of this event.</param> /// <param name="subItemIndex">Gets the index of the sub item under the hit point.</param> /// <param name="location">The location of the mouse.</param> /// <param name="buttons">One of the System.Windows.Forms.MouseButtons values /// indicating which mouse button was pressed.</param> public ItemClickEventArgs(ImageListViewItem item, int subItemIndex, Point location, MouseButtons buttons) { Item = item; SubItemIndex = subItemIndex; Location = location; Buttons = buttons; }
/// <summary> /// Draws the checkbox icon for the specified item on the given graphics. /// </summary> /// <param name="g">The System.Drawing.Graphics to draw on.</param> /// <param name="item">The ImageListViewItem to draw.</param> /// <param name="bounds">The bounding rectangle of the checkbox in client coordinates.</param> public override void DrawCheckBox(Graphics g, ImageListViewItem item, Rectangle bounds) { ; }
/// <summary> /// Draws the specified item on the given graphics. /// </summary> /// <param name="g">The System.Drawing.Graphics to draw on.</param> /// <param name="item">The ImageListViewItem to draw.</param> /// <param name="state">The current view state of item.</param> /// <param name="bounds">The bounding rectangle of item in client coordinates.</param> public override void DrawItem(Graphics g, ImageListViewItem item, ItemState state, Rectangle bounds) { if (ImageListView.View == Manina.Windows.Forms.View.Thumbnails) { Size itemPadding = new Size(4, 4); #region Paint background using (Brush bItemBack = new SolidBrush(item.BackColor)) { g.FillRectangle(bItemBack, bounds); } if ((ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None)) || (!ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None) && ((state & ItemState.Hovered) != ItemState.None))) { using (Brush bSelected = new LinearGradientBrush(bounds, Color.FromArgb(16, SystemColors.Highlight), Color.FromArgb(64, SystemColors.Highlight), LinearGradientMode.Vertical)) { Utility.FillRoundedRectangle(g, bSelected, bounds, 4); } } else if (!ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None)) { using (Brush bGray64 = new LinearGradientBrush(bounds, Color.FromArgb(16, SystemColors.GrayText), Color.FromArgb(64, SystemColors.GrayText), LinearGradientMode.Vertical)) { Utility.FillRoundedRectangle(g, bGray64, bounds, 4); } } if (((state & ItemState.Hovered) != ItemState.None)) { using (Brush bHovered = new LinearGradientBrush(bounds, Color.FromArgb(8, SystemColors.Highlight), Color.FromArgb(32, SystemColors.Highlight), LinearGradientMode.Vertical)) { Utility.FillRoundedRectangle(g, bHovered, bounds, 4); } } #endregion #region Draw the image and Title(s) Image img = item.ThumbnailImage; if (img != null) { Rectangle pos = Utility.GetSizedImageBounds(img, new Rectangle(bounds.Location + itemPadding, ImageListView.ThumbnailSize), 0.0f, 50.0f); g.DrawImage(img, pos); DrawThumbnail(g, item, img, pos); // Draw image border if (Math.Min(pos.Width, pos.Height) > 32) { using (Pen pGray128 = new Pen(Color.FromArgb(128, Color.Gray))) { g.DrawRectangle(pGray128, pos); } using (Pen pWhite128 = new Pen(Color.FromArgb(128, Color.White))) { g.DrawRectangle(pWhite128, Rectangle.Inflate(pos, -1, -1)); } } // Draw item text int lineHeight = CaptionFont.Height; RectangleF rt; using (StringFormat sf = new StringFormat()) { rt = new RectangleF(bounds.Left + 2 * itemPadding.Width + ImageListView.ThumbnailSize.Width, bounds.Top + itemPadding.Height + (Math.Max(ImageListView.ThumbnailSize.Height, mTextHeight) - mTextHeight) / 2, mTileWidth, lineHeight); sf.Alignment = StringAlignment.Near; sf.FormatFlags = StringFormatFlags.NoWrap; sf.LineAlignment = StringAlignment.Center; sf.Trimming = StringTrimming.EllipsisCharacter; using (Brush bItemFore = new SolidBrush(item.ForeColor)) { g.DrawString(item.GetSubItemText(ImageListView.TitleLine1), CaptionFont, bItemFore, rt, sf); } using (Brush bItemDetails = new SolidBrush(Color.Gray)) { //Line 2 : rt.Offset(0, 1.5f * lineHeight); string line; try { line = item.GetSubItemText(ImageListView.TitleLine2); g.DrawString(line, ImageListView.Font, bItemDetails, rt, sf); rt.Offset(0, 1.1f * lineHeight); line = item.GetSubItemText(ImageListView.TitleLine3); g.DrawString(line, ImageListView.Font, bItemDetails, rt, sf); rt.Offset(0, 1.1f * lineHeight); line = item.GetSubItemText(ImageListView.TitleLine4); g.DrawString(line, ImageListView.Font, bItemDetails, rt, sf); rt.Offset(0, 1.1f * lineHeight); line = item.GetSubItemText(ImageListView.TitleLine5); g.DrawString(line, ImageListView.Font, bItemDetails, rt, sf); rt.Offset(0, 1.1f * lineHeight); } catch (Exception ex) { Console.WriteLine(ex.Message); //For debug reason //Error can occure when ImageListView.Font } } } } #endregion #region Item border using (Pen pWhite128 = new Pen(Color.FromArgb(128, Color.White))) { Utility.DrawRoundedRectangle(g, pWhite128, bounds.Left + 1, bounds.Top + 1, bounds.Width - 3, bounds.Height - 3, 4); } if (ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None)) { using (Pen pHighlight128 = new Pen(Color.FromArgb(128, SystemColors.Highlight))) { Utility.DrawRoundedRectangle(g, pHighlight128, bounds.Left, bounds.Top, bounds.Width - 1, bounds.Height - 1, 4); } } else if (!ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None)) { using (Pen pGray128 = new Pen(Color.FromArgb(128, SystemColors.GrayText))) { Utility.DrawRoundedRectangle(g, pGray128, bounds.Left, bounds.Top, bounds.Width - 1, bounds.Height - 1, 4); } } else if ((state & ItemState.Selected) == ItemState.None) { using (Pen pGray64 = new Pen(Color.FromArgb(64, SystemColors.GrayText))) { Utility.DrawRoundedRectangle(g, pGray64, bounds.Left, bounds.Top, bounds.Width - 1, bounds.Height - 1, 4); } } if (ImageListView.Focused && ((state & ItemState.Hovered) != ItemState.None)) { using (Pen pHighlight64 = new Pen(Color.FromArgb(64, SystemColors.Highlight))) { Utility.DrawRoundedRectangle(g, pHighlight64, bounds.Left, bounds.Top, bounds.Width - 1, bounds.Height - 1, 4); } } #endregion #region Focus rectangle if (ImageListView.Focused && ((state & ItemState.Focused) != ItemState.None)) { ControlPaint.DrawFocusRectangle(g, bounds); } #endregion } else { Image img = item.ThumbnailImage; //JTN Added - Force image cahcing to be triggered base.DrawItem(g, item, state, bounds); } }
/// <summary> /// Initializes a new instance of the CacheErrorEventArgs class. /// </summary> /// <param name="item">The ImageListViewItem that is associated with this error.</param> /// <param name="error">The error that occurred during an asynchronous operation.</param> /// <param name="cacheThread">The thread raising the error.</param> public CacheErrorEventArgs(ImageListViewItem item, Exception error, CacheThread cacheThread) { Item = item; Error = error; CacheThread = cacheThread; }
/// <summary> /// Creates a new object that is a copy of the current instance. /// </summary> public object Clone() { ImageListViewItem item = new ImageListViewItem(); item.mText = mText; // File info item.extension = extension; item.mDateAccessed = mDateAccessed; item.mDateCreated = mDateCreated; item.mDateModified = mDateModified; item.mFileType = mFileType; item.mFileName = mFileName; item.mFilePath = mFilePath; item.mFileSize = mFileSize; // Image info item.mDimensions = mDimensions; item.mResolution = mResolution; // Exif tags item.mImageDescription = mImageDescription; item.mEquipmentModel = mEquipmentModel; item.mDateTaken = mDateTaken; item.mArtist = mArtist; item.mCopyright = mCopyright; item.mExposureTime = mExposureTime; item.mFNumber = mFNumber; item.mISOSpeed = mISOSpeed; item.mUserComment = mUserComment; item.mRating = mRating; item.mStarRating = mStarRating; item.mSoftware = mSoftware; item.mFocalLength = mFocalLength; // Virtual item properties item.mAdaptor = mAdaptor; item.mVirtualItemKey = mVirtualItemKey; // Sub items foreach (KeyValuePair<Guid, string> kv in subItems) item.subItems.Add(kv.Key, kv.Value); // Current thumbnail if (mImageListView != null) { item.clonedThumbnail = mImageListView.thumbnailCache.GetImage(Guid, mImageListView.ThumbnailSize, mImageListView.UseEmbeddedThumbnails, mImageListView.AutoRotateThumbnails, mImageListView.UseWIC == UseWIC.Auto || mImageListView.UseWIC == UseWIC.ThumbnailsOnly, true); } return item; }
/// <summary> /// Initializes a new instance of the ThumbnailCachedEventArgs class. /// </summary> /// <param name="item">The item that is the target of this event.</param> /// <param name="thumbnail">The cached thumbnail image.</param> /// <param name="size">The size of the thumbnail request.</param> /// <param name="thumbnailImage">true if the cached image is a thumbnail image; otherwise false /// if the image is a large image for gallery or pane views.</param> public ThumbnailCachedEventArgs(ImageListViewItem item, Image thumbnail, Size size, bool thumbnailImage) { Item = item; Thumbnail = thumbnail; Size = size; IsThumbnail = thumbnailImage; }
/// <summary> /// Initializes a new instance of the ItemCollectionChangedEventArgs class. /// </summary> /// <param name="action">The type of action causing the change.</param> /// <param name="item">The item that is the target of this event. This parameter will be null /// if the collection is cleared.</param> public ItemCollectionChangedEventArgs(CollectionChangeAction action, ImageListViewItem item) { Action = action; Item = item; }
/// <summary> /// Draws the specified item on the given graphics. /// </summary> /// <param name="g">The System.Drawing.Graphics to draw on.</param> /// <param name="item">The ImageListViewItem to draw.</param> /// <param name="state">The current view state of item.</param> /// <param name="bounds">The bounding rectangle of item in client coordinates.</param> public override void DrawItem(Graphics g, ImageListViewItem item, ItemState state, Rectangle bounds) { if (ImageListView.View == Manina.Windows.Forms.View.Thumbnails) { // Zoom on mouse over if ((state & ItemState.Hovered) != ItemState.None) { bounds.Inflate((int)(bounds.Width * mZoomRatio), (int)(bounds.Height * mZoomRatio)); if (bounds.Bottom > ItemAreaBounds.Bottom) bounds.Y = ItemAreaBounds.Bottom - bounds.Height; if (bounds.Top < ItemAreaBounds.Top) bounds.Y = ItemAreaBounds.Top; if (bounds.Right > ItemAreaBounds.Right) bounds.X = ItemAreaBounds.Right - bounds.Width; if (bounds.Left < ItemAreaBounds.Left) bounds.X = ItemAreaBounds.Left; } // Get item image Image img = null; if ((state & ItemState.Hovered) != ItemState.None) img = GetImageAsync(item, new Size(bounds.Width - 8, bounds.Height - 8)); if (img == null) img = item.ThumbnailImage; // Calculate image bounds Rectangle pos = Utility.GetSizedImageBounds(img, Rectangle.Inflate(bounds, -4, -4)); int imageWidth = pos.Width; int imageHeight = pos.Height; int imageX = pos.X; int imageY = pos.Y; // Allocate space for item text if ((state & ItemState.Hovered) != ItemState.None && (bounds.Height - imageHeight) / 2 < ImageListView.Font.Height + 8) { int delta = (ImageListView.Font.Height + 8) - (bounds.Height - imageHeight) / 2; bounds.Height += 2 * delta; imageY += delta; } // Paint background using (Brush bBack = new SolidBrush(ImageListView.BackColor)) { Utility.FillRoundedRectangle(g, bBack, bounds, 5); } using (Brush bItemBack = new SolidBrush(item.BackColor)) { Utility.FillRoundedRectangle(g, bItemBack, bounds, 5); } if ((ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None)) || (!ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None) && ((state & ItemState.Hovered) != ItemState.None))) { using (Brush bSelected = new LinearGradientBrush(bounds, Color.FromArgb(16, SystemColors.Highlight), Color.FromArgb(64, SystemColors.Highlight), LinearGradientMode.Vertical)) { Utility.FillRoundedRectangle(g, bSelected, bounds, 5); } } else if (!ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None)) { using (Brush bGray64 = new LinearGradientBrush(bounds, Color.FromArgb(16, SystemColors.GrayText), Color.FromArgb(64, SystemColors.GrayText), LinearGradientMode.Vertical)) { Utility.FillRoundedRectangle(g, bGray64, bounds, 5); } } if (((state & ItemState.Hovered) != ItemState.None)) { using (Brush bHovered = new LinearGradientBrush(bounds, Color.FromArgb(8, SystemColors.Highlight), Color.FromArgb(32, SystemColors.Highlight), LinearGradientMode.Vertical)) { Utility.FillRoundedRectangle(g, bHovered, bounds, 5); } } // Draw the image g.DrawImage(img, imageX, imageY, imageWidth, imageHeight); // Draw image border if (Math.Min(imageWidth, imageHeight) > 32) { using (Pen pGray128 = new Pen(Color.FromArgb(128, Color.Gray))) { g.DrawRectangle(pGray128, imageX, imageY, imageWidth, imageHeight); } if (System.Math.Min(imageWidth, imageHeight) > 32) { using (Pen pWhite128 = new Pen(Color.FromArgb(128, Color.White))) { g.DrawRectangle(pWhite128, imageX + 1, imageY + 1, imageWidth - 2, imageHeight - 2); } } } // Draw item text if ((state & ItemState.Hovered) != ItemState.None) { RectangleF rt; using (StringFormat sf = new StringFormat()) { rt = new RectangleF(bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, (bounds.Height - imageHeight) / 2 - 8); sf.Alignment = StringAlignment.Center; sf.FormatFlags = StringFormatFlags.NoWrap; sf.LineAlignment = StringAlignment.Center; sf.Trimming = StringTrimming.EllipsisCharacter; using (Brush bItemFore = new SolidBrush(item.ForeColor)) { g.DrawString(item.Text, ImageListView.Font, bItemFore, rt, sf); } rt.Y = bounds.Bottom - (bounds.Height - imageHeight) / 2 + 4; string details = ""; if (item.Dimensions != Size.Empty) details += item.GetSubItemText(ColumnType.Dimensions) + " pixels "; if (item.FileSize != 0) details += item.GetSubItemText(ColumnType.FileSize); using (Brush bGrayText = new SolidBrush(Color.Gray)) { g.DrawString(details, ImageListView.Font, bGrayText, rt, sf); } } } // Item border using (Pen pWhite128 = new Pen(Color.FromArgb(128, Color.White))) { Utility.DrawRoundedRectangle(g, pWhite128, bounds.Left + 1, bounds.Top + 1, bounds.Width - 3, bounds.Height - 3, 4); } if (ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None)) { using (Pen pHighlight128 = new Pen(Color.FromArgb(128, SystemColors.Highlight))) { Utility.DrawRoundedRectangle(g, pHighlight128, bounds.Left, bounds.Top, bounds.Width - 1, bounds.Height - 1, 4); } } else if (!ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None)) { using (Pen pGray128 = new Pen(Color.FromArgb(128, SystemColors.GrayText))) { Utility.DrawRoundedRectangle(g, pGray128, bounds.Left, bounds.Top, bounds.Width - 1, bounds.Height - 1, 4); } } else if ((state & ItemState.Selected) == ItemState.None) { using (Pen pGray64 = new Pen(Color.FromArgb(64, SystemColors.GrayText))) { Utility.DrawRoundedRectangle(g, pGray64, bounds.Left, bounds.Top, bounds.Width - 1, bounds.Height - 1, 4); } } if (ImageListView.Focused && ((state & ItemState.Hovered) != ItemState.None)) { using (Pen pHighlight64 = new Pen(Color.FromArgb(64, SystemColors.Highlight))) { Utility.DrawRoundedRectangle(g, pHighlight64, bounds.Left, bounds.Top, bounds.Width - 1, bounds.Height - 1, 4); } } } else base.DrawItem(g, item, state, bounds); }
/// <summary> /// Initializes a new instance of the ItemEventArgs class. /// </summary> /// <param name="item">The currently hovered item.</param> /// <param name="subItemIndex">The index of the hovered sub item.</param> /// <param name="previousItem">The previously hovered item.</param> /// <param name="previousSubItemIndex">The index of the sub item that was previously hovered.</param> public ItemHoverEventArgs(ImageListViewItem item, int subItemIndex, ImageListViewItem previousItem, int previousSubItemIndex) { Item = item; SubItemIndex = subItemIndex; PreviousItem = previousItem; PreviousSubItemIndex = previousSubItemIndex; }
/// <summary> /// Draws the large preview image of the focused item in Gallery mode. /// </summary> /// <param name="g">The System.Drawing.Graphics to draw on.</param> /// <param name="item">The ImageListViewItem to draw.</param> /// <param name="image">The image to draw.</param> /// <param name="bounds">The bounding rectangle of the preview area.</param> public override void DrawGalleryImage(Graphics g, ImageListViewItem item, Image image, Rectangle bounds) { if (item != null && image != null) { Size itemMargin = MeasureItemMargin(ImageListView.View); Rectangle pos = Utility.GetSizedImageBounds(image, new Rectangle(bounds.X + itemMargin.Width, bounds.Y + itemMargin.Height, bounds.Width - 2 * itemMargin.Width, bounds.Height - 2 * itemMargin.Height - mReflectionSize), 50.0f, 100.0f); DrawImageWithReflection(g, image, pos, mReflectionSize); } }
/// <summary> /// Draws the specified item on the given graphics. /// </summary> /// <param name="g">The System.Drawing.Graphics to draw on.</param> /// <param name="item">The ImageListViewItem to draw.</param> /// <param name="state">The current view state of item.</param> /// <param name="bounds">The bounding rectangle of item in client coordinates.</param> public override void DrawItem(Graphics g, ImageListViewItem item, ItemState state, Rectangle bounds) { // Fill with item background color if (item.BackColor != Color.Transparent) { using (Brush brush = new SolidBrush(item.BackColor)) { g.FillRectangle(brush, bounds); } } if (ImageListView.View == View.Details) { // Item background if ((state & ItemState.Selected) == ItemState.Selected) { using (Brush brush = new LinearGradientBrush(bounds, Color.FromArgb(64, 96, 160), Color.FromArgb(64, 64, 96, 160), LinearGradientMode.Horizontal)) { g.FillRectangle(brush, bounds); } } else if ((state & ItemState.Hovered) == ItemState.Hovered) { using (Brush brush = new LinearGradientBrush(bounds, Color.FromArgb(64, Color.White), Color.FromArgb(16, Color.White), LinearGradientMode.Horizontal)) { g.FillRectangle(brush, bounds); } } // Shade sort column List<ImageListView.ImageListViewColumnHeader> uicolumns = mImageListView.Columns.GetDisplayedColumns(); int x = mImageListView.layoutManager.ColumnHeaderBounds.Left; foreach (ImageListView.ImageListViewColumnHeader column in uicolumns) { if (mImageListView.SortColumn == column.Type && mImageListView.SortOrder != SortOrder.None && (state & ItemState.Hovered) == ItemState.None && (state & ItemState.Selected) == ItemState.None) { Rectangle subItemBounds = bounds; subItemBounds.X = x; subItemBounds.Width = column.Width; using (Brush brush = new SolidBrush(Color.FromArgb(32, 128, 128, 128))) { g.FillRectangle(brush, subItemBounds); } break; } x += column.Width; } // Separators x = mImageListView.layoutManager.ColumnHeaderBounds.Left; foreach (ImageListView.ImageListViewColumnHeader column in uicolumns) { x += column.Width; if (!ReferenceEquals(column, uicolumns[uicolumns.Count - 1])) { using (Pen pen = new Pen(Color.FromArgb(64, 128, 128, 128))) { g.DrawLine(pen, x, bounds.Top, x, bounds.Bottom); } } } // Item texts Size offset = new Size(2, (bounds.Height - mImageListView.Font.Height) / 2); using (StringFormat sf = new StringFormat()) { sf.FormatFlags = StringFormatFlags.NoWrap; sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Center; sf.Trimming = StringTrimming.EllipsisCharacter; // Sub text RectangleF rt = new RectangleF(bounds.Left + offset.Width, bounds.Top + offset.Height, uicolumns[0].Width - 2 * offset.Width, bounds.Height - 2 * offset.Height); foreach (ImageListView.ImageListViewColumnHeader column in uicolumns) { rt.Width = column.Width - 2 * offset.Width; using (Brush bItemFore = new SolidBrush(Color.White)) { g.DrawString(item.GetSubItemText(column.Type), mImageListView.Font, bItemFore, rt, sf); } rt.X += column.Width; } } // Border if ((state & ItemState.Hovered) == ItemState.Hovered) { using (Pen pen = new Pen(Color.FromArgb(128, Color.White))) { g.DrawRectangle(pen, bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1); } } else if ((state & ItemState.Selected) == ItemState.Hovered) { using (Pen pen = new Pen(Color.FromArgb(96, 144, 240))) { g.DrawRectangle(pen, bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1); } } } else { // Align images to bottom of bounds Image img = item.ThumbnailImage; Rectangle pos = Utility.GetSizedImageBounds(img, new Rectangle(bounds.X + padding, bounds.Y + padding, bounds.Width - 2 * padding, bounds.Height - 2 * padding - mReflectionSize), 50.0f, 100.0f); int x = pos.X; int y = pos.Y; // Item background if ((state & ItemState.Selected) == ItemState.Selected) { using (Brush brush = new LinearGradientBrush( new Point(x - padding, y - padding), new Point(x - padding, y + pos.Height + 2 * padding), Color.FromArgb(64, 96, 160), Color.FromArgb(16, 16, 16))) { g.FillRectangle(brush, x - padding, y - padding, pos.Width + 2 * padding, pos.Height + 2 * padding); } } else if ((state & ItemState.Hovered) == ItemState.Hovered) { using (Brush brush = new LinearGradientBrush( new Point(x - padding, y - padding), new Point(x - padding, y + pos.Height + 2 * padding), Color.FromArgb(64, Color.White), Color.FromArgb(16, 16, 16))) { g.FillRectangle(brush, x - padding, y - padding, pos.Width + 2 * padding, pos.Height + 2 * padding); } } // Border if ((state & ItemState.Hovered) == ItemState.Hovered) { using (Brush brush = new LinearGradientBrush( new Point(x - padding, y - padding), new Point(x - padding, y + pos.Height + 2 * padding), Color.FromArgb(128, Color.White), Color.FromArgb(16, 16, 16))) using (Pen pen = new Pen(brush)) { g.DrawRectangle(pen, x - padding, y - padding + 1, pos.Width + 2 * padding - 1, pos.Height + 2 * padding - 1); } } else if ((state & ItemState.Selected) == ItemState.Selected) { using (Brush brush = new LinearGradientBrush( new Point(x - padding, y - padding), new Point(x - padding, y + pos.Height + 2 * padding), Color.FromArgb(96, 144, 240), Color.FromArgb(16, 16, 16))) using (Pen pen = new Pen(brush)) { g.DrawRectangle(pen, x - padding, y - padding + 1, pos.Width + 2 * padding - 1, pos.Height + 2 * padding - 1); } } // Draw item image DrawImageWithReflection(g, img, pos, mReflectionSize); // Highlight using (Pen pen = new Pen(Color.FromArgb(160, Color.White))) { g.DrawLine(pen, pos.X, pos.Y + 1, pos.X + pos.Width - 1, pos.Y + 1); g.DrawLine(pen, pos.X, pos.Y + 1, pos.X, pos.Y + pos.Height); } } }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { var worker = sender as BackgroundWorker; if (!Directory.Exists("temp")) { Directory.CreateDirectory("temp"); } var client = new WebClient(); client.DownloadFile("http://thetvdb.com/api/" + Constants.ApiKey + "/series/" + _seriesId + "/all/en.zip", @"temp/tmp.zip"); using (var zip = ZipFile.Read("temp/tmp.zip")) { zip.ExtractAll("temp/"); } var doc = XDocument.Load("temp/banners.xml"); var names = from ele in doc.Descendants("Banner") select new { url = (string)ele.Element("BannerPath"), type = (string)ele.Element("BannerType") }; foreach (var n in names.Where(n => n.type != "season")) { switch (e.Argument.ToString()) { case "0": if (n.type != "fanart" && n.type != "poster") { client.DownloadFile("http://thetvdb.com/banners/" + n.url, @"temp/" + Path.GetFileName(n.url)); var img = new ImageListViewItem {FileName = @"temp/" + Path.GetFileName(n.url)}; if (worker != null) worker.ReportProgress(0, img); } break; case "1": if (n.type != "fanart" && n.type != "series") { client.DownloadFile("http://thetvdb.com/banners/" + n.url, @"temp/" + Path.GetFileName(n.url)); var img = new ImageListViewItem {FileName = @"temp/" + Path.GetFileName(n.url)}; if (worker != null) worker.ReportProgress(0, img); } break; case "2": if (n.type != "series" && n.type != "poster") { client.DownloadFile("http://thetvdb.com/banners/" + n.url, @"temp/" + Path.GetFileName(n.url)); var img = new ImageListViewItem {FileName = @"temp/" + Path.GetFileName(n.url)}; if (worker != null) worker.ReportProgress(0, img); } break; } } }
/// <summary> /// Draws the left pane in Pane view mode. /// </summary> /// <param name="g">The System.Drawing.Graphics to draw on.</param> /// <param name="item">The ImageListViewItem to draw.</param> /// <param name="image">The image to draw.</param> /// <param name="bounds">The bounding rectangle of the pane.</param> public override void DrawPane(Graphics g, ImageListViewItem item, Image image, Rectangle bounds) { // Draw resize handle using (Brush bBorder = new SolidBrush(Color.FromArgb(64, 64, 64))) { g.FillRectangle(bBorder, bounds.Right - 2, bounds.Top, 2, bounds.Height); } bounds.Width -= 2; if (item != null && image != null) { // Calculate image bounds Size itemMargin = MeasureItemMargin(ImageListView.View); Rectangle pos = Utility.GetSizedImageBounds(image, new Rectangle(bounds.Location + itemMargin, bounds.Size - itemMargin - itemMargin), 50.0f, 0.0f); // Draw image g.DrawImage(image, pos); bounds.X += itemMargin.Width; bounds.Width -= 2 * itemMargin.Width; bounds.Y = pos.Height + 16; bounds.Height -= pos.Height + 16; // Item text if (mImageListView.Columns[ColumnType.Name].Visible && bounds.Height > 0) { int y = Utility.DrawStringPair(g, bounds, "", item.Text, mImageListView.Font, Brushes.White, Brushes.White); bounds.Y += 2 * y; bounds.Height -= 2 * y; } // File type if (mImageListView.Columns[ColumnType.FileType].Visible && bounds.Height > 0 && !string.IsNullOrEmpty(item.FileType)) { using (Brush bCaption = new SolidBrush(Color.FromArgb(196, 196, 196))) using (Brush bText = new SolidBrush(Color.White)) { int y = Utility.DrawStringPair(g, bounds, mImageListView.Columns[ColumnType.FileType].Text + ": ", item.FileType, mImageListView.Font, bCaption, bText); bounds.Y += y; bounds.Height -= y; } } // Metatada foreach (ImageListView.ImageListViewColumnHeader column in mImageListView.Columns) { if (column.Type == ColumnType.ImageDescription) { bounds.Y += 8; bounds.Height -= 8; } if (bounds.Height <= 0) break; if (column.Visible && column.Type != ColumnType.FileType && column.Type != ColumnType.DateAccessed && column.Type != ColumnType.FileName && column.Type != ColumnType.FilePath && column.Type != ColumnType.Name) { string caption = column.Text; string text = item.GetSubItemText(column.Type); if (!string.IsNullOrEmpty(text)) { using (Brush bCaption = new SolidBrush(Color.FromArgb(196, 196, 196))) using (Brush bText = new SolidBrush(Color.White)) { int y = Utility.DrawStringPair(g, bounds, caption + ": ", text, mImageListView.Font, bCaption, bText); bounds.Y += y; bounds.Height -= y; } } } } } }
/// <summary> /// Updates item details. /// This method is invoked from the item cache thread. /// </summary> internal void UpdateItemDetailsInternal(ImageListViewItem item, VirtualItemDetailsEventArgs info) { item.UpdateDetailsInternal(info); }
/// <summary> /// Draws the specified item on the given graphics. /// </summary> /// <param name="g">The System.Drawing.Graphics to draw on.</param> /// <param name="item">The ImageListViewItem to draw.</param> /// <param name="state">The current view state of item.</param> /// <param name="bounds">The bounding rectangle of item in client coordinates.</param> public override void DrawItem(Graphics g, ImageListViewItem item, ItemState state, Rectangle bounds) { if (ImageListView.View == Manina.Windows.Forms.View.Thumbnails) { Size itemPadding = new Size(4, 4); // Paint background using (Brush bItemBack = new SolidBrush(item.BackColor)) { g.FillRectangle(bItemBack, bounds); } if ((ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None)) || (!ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None) && ((state & ItemState.Hovered) != ItemState.None))) { using (Brush bSelected = new LinearGradientBrush(bounds, Color.FromArgb(16, SystemColors.Highlight), Color.FromArgb(64, SystemColors.Highlight), LinearGradientMode.Vertical)) { Utility.FillRoundedRectangle(g, bSelected, bounds, 4); } } else if (!ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None)) { using (Brush bGray64 = new LinearGradientBrush(bounds, Color.FromArgb(16, SystemColors.GrayText), Color.FromArgb(64, SystemColors.GrayText), LinearGradientMode.Vertical)) { Utility.FillRoundedRectangle(g, bGray64, bounds, 4); } } if (((state & ItemState.Hovered) != ItemState.None)) { using (Brush bHovered = new LinearGradientBrush(bounds, Color.FromArgb(8, SystemColors.Highlight), Color.FromArgb(32, SystemColors.Highlight), LinearGradientMode.Vertical)) { Utility.FillRoundedRectangle(g, bHovered, bounds, 4); } } // Draw the image Image img = item.ThumbnailImage; if (img != null) { Rectangle pos = Utility.GetSizedImageBounds(img, new Rectangle(bounds.Location + itemPadding, ImageListView.ThumbnailSize), 0.0f, 50.0f); g.DrawImage(img, pos); // Draw image border if (Math.Min(pos.Width, pos.Height) > 32) { using (Pen pGray128 = new Pen(Color.FromArgb(128, Color.Gray))) { g.DrawRectangle(pGray128, pos); } using (Pen pWhite128 = new Pen(Color.FromArgb(128, Color.White))) { g.DrawRectangle(pWhite128, Rectangle.Inflate(pos, -1, -1)); } } // Draw item text int lineHeight = CaptionFont.Height; RectangleF rt; using (StringFormat sf = new StringFormat()) { rt = new RectangleF(bounds.Left + 2 * itemPadding.Width + ImageListView.ThumbnailSize.Width, bounds.Top + itemPadding.Height + (Math.Max(ImageListView.ThumbnailSize.Height, mTextHeight) - mTextHeight) / 2, mTileWidth, lineHeight); sf.Alignment = StringAlignment.Near; sf.FormatFlags = StringFormatFlags.NoWrap; sf.LineAlignment = StringAlignment.Center; sf.Trimming = StringTrimming.EllipsisCharacter; using (Brush bItemFore = new SolidBrush(item.ForeColor)) { g.DrawString(item.Text, CaptionFont, bItemFore, rt, sf); } using (Brush bItemDetails = new SolidBrush(Color.Gray)) { rt.Offset(0, 1.5f * lineHeight); if (!string.IsNullOrEmpty(item.FileType)) { g.DrawString(item.GetSubItemText(ColumnType.FileType), ImageListView.Font, bItemDetails, rt, sf); rt.Offset(0, 1.1f * lineHeight); } if (item.Dimensions != Size.Empty || item.Resolution != SizeF.Empty) { string text = ""; if (item.Dimensions != Size.Empty) text += item.GetSubItemText(ColumnType.Dimensions) + " pixels "; if (item.Resolution != SizeF.Empty) text += item.Resolution.Width + " dpi"; g.DrawString(text, ImageListView.Font, bItemDetails, rt, sf); rt.Offset(0, 1.1f * lineHeight); } if (item.FileSize != 0) { g.DrawString(item.GetSubItemText(ColumnType.FileSize), ImageListView.Font, bItemDetails, rt, sf); rt.Offset(0, 1.1f * lineHeight); } if (item.DateModified != DateTime.MinValue) { g.DrawString(item.GetSubItemText(ColumnType.DateModified), ImageListView.Font, bItemDetails, rt, sf); } } } } // Item border using (Pen pWhite128 = new Pen(Color.FromArgb(128, Color.White))) { Utility.DrawRoundedRectangle(g, pWhite128, bounds.Left + 1, bounds.Top + 1, bounds.Width - 3, bounds.Height - 3, 4); } if (ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None)) { using (Pen pHighlight128 = new Pen(Color.FromArgb(128, SystemColors.Highlight))) { Utility.DrawRoundedRectangle(g, pHighlight128, bounds.Left, bounds.Top, bounds.Width - 1, bounds.Height - 1, 4); } } else if (!ImageListView.Focused && ((state & ItemState.Selected) != ItemState.None)) { using (Pen pGray128 = new Pen(Color.FromArgb(128, SystemColors.GrayText))) { Utility.DrawRoundedRectangle(g, pGray128, bounds.Left, bounds.Top, bounds.Width - 1, bounds.Height - 1, 4); } } else if ((state & ItemState.Selected) == ItemState.None) { using (Pen pGray64 = new Pen(Color.FromArgb(64, SystemColors.GrayText))) { Utility.DrawRoundedRectangle(g, pGray64, bounds.Left, bounds.Top, bounds.Width - 1, bounds.Height - 1, 4); } } if (ImageListView.Focused && ((state & ItemState.Hovered) != ItemState.None)) { using (Pen pHighlight64 = new Pen(Color.FromArgb(64, SystemColors.Highlight))) { Utility.DrawRoundedRectangle(g, pHighlight64, bounds.Left, bounds.Top, bounds.Width - 1, bounds.Height - 1, 4); } } // Focus rectangle if (ImageListView.Focused && ((state & ItemState.Focused) != ItemState.None)) { ControlPaint.DrawFocusRectangle(g, bounds); } } else base.DrawItem(g, item, state, bounds); }
/// <summary> /// Determines whether the specified item is visible on the screen. /// </summary> /// <param name="item">The item to test.</param> /// <returns>An ItemVisibility value.</returns> public ItemVisibility IsItemVisible(ImageListViewItem item) { return IsItemVisible(item.Index); }
/// <summary> /// Draws the large preview image of the focused item in Gallery mode. /// </summary> /// <param name="g">The System.Drawing.Graphics to draw on.</param> /// <param name="item">The ImageListViewItem to draw.</param> /// <param name="image">The image to draw.</param> /// <param name="bounds">The bounding rectangle of the preview area.</param> public override void DrawGalleryImage(Graphics g, ImageListViewItem item, Image image, Rectangle bounds) { // Calculate image bounds Size itemMargin = MeasureItemMargin(mImageListView.View); Rectangle pos = Utility.GetSizedImageBounds(image, new Rectangle(bounds.Location + itemMargin, bounds.Size - itemMargin - itemMargin)); // Draw image g.DrawImage(image, pos); // Draw image border if (Math.Min(pos.Width, pos.Height) > 32) { using (Pen pBorder = new Pen(Color.Black)) { g.DrawRectangle(pBorder, pos); } } }
/// <summary> /// Raises the ItemCheckBoxClick event. /// </summary> /// <param name="item">The checked item.</param> internal virtual void OnItemCheckBoxClickInternal(ImageListViewItem item) { OnItemCheckBoxClick(new ItemEventArgs(item)); }
/// <summary> /// Initializes a new instance of the ItemClickEventArgs class. /// </summary> /// <param name="item">The item that is the target of this event.</param> /// <param name="location">The location of the mouse.</param> /// <param name="buttons">One of the System.Windows.Forms.MouseButtons values /// indicating which mouse button was pressed.</param> public ItemClickEventArgs(ImageListViewItem item, Point location, MouseButtons buttons) { mItem = item; mLocation = location; mButtons = buttons; }