/// <summary> /// Initializes a new instance of the ImageListViewNavigationManager class. /// </summary> /// <param name="owner">The owner control.</param> public ImageListViewNavigationManager(ImageListView owner) { mImageListView = owner; DraggingSeperator = false; ResizingPane = false; LeftButton = false; RightButton = false; ShiftKey = false; ControlKey = false; HoveredItem = null; HoveredColumn = null; HoveredSeparator = null; SelectedSeperator = null; HoveredPaneBorder = false; MouseSelecting = false; DropTarget = null; DropToRight = false; selfDragging = false; highlightedItems = new Dictionary<ImageListViewItem, bool>(); scrollTimer = new System.Windows.Forms.Timer(); scrollTimer.Interval = 100; scrollTimer.Enabled = false; scrollTimer.Tick += new EventHandler(scrollTimer_Tick); suppressClick = false; }
/// <summary> /// Initializes a new instance of the <see cref="CacheRequest"/> class. /// </summary> /// <param name="guid">The guid of the item.</param> /// <param name="adaptor">The adaptor of this item.</param> /// <param name="virtualItemKey">The virtual item key of this item.</param> /// <param name="useWIC">Whether to use the Windows Imaging Component.</param> public CacheRequest(Guid guid, ImageListView.ImageListViewItemAdaptor adaptor, object virtualItemKey, bool useWIC) { Guid = guid; Adaptor = adaptor; VirtualItemKey = virtualItemKey; UseWIC = useWIC; }
internal String DisplayCommonRenamingDialog(ImageListView.ImageListViewSelectedItemCollection items) { RenameComponentDialog rcd = new RenameComponentDialog(); String commonName = null; foreach (ImageListViewItem ilvi in items) { SiDComponent comp = ilvi.Tag as SiDComponent; if (commonName == null) { commonName = comp.Name; } else if (commonName != comp.Name) { commonName = ""; rcd.noCommonality.Visible = true; } } if (commonName != null) { rcd.tbNameText.Text = commonName; if (rcd.ShowDialog() == DialogResult.OK) { return rcd.tbNameText.Text; } } return null; }
/// <summary> /// Initializes a new instance of the ImageListViewCacheManager class. /// </summary> /// <param name="owner">The owner control.</param> public ImageListViewCacheManager(ImageListView owner) { lockObject = new object(); mImageListView = owner; mCacheMode = CacheMode.OnDemand; mCacheLimitAsItemCount = 0; mCacheLimitAsMemory = 20 * 1024 * 1024; mRetryOnError = owner.RetryOnError; toCache = new Stack<CacheItem>(); thumbCache = new Dictionary<Guid, CacheItem>(); editCache = new Dictionary<Guid, Image>(); rendererToCache = new Stack<CacheItem>(); rendererGuid = new Guid(); rendererItem = null; memoryUsed = 0; memoryUsedByRemoved = 0; removedItems = new List<Guid>(); mThread = new Thread(new ThreadStart(DoWork)); mThread.IsBackground = true; stopping = false; stopped = false; disposed = false; mThread.Start(); while (!mThread.IsAlive) ; }
/// <summary> /// Initializes a new instance of the ImageListViewActionLists class. /// </summary> /// <param name="component">A component related to the DesignerActionList.</param> public ImageListViewActionLists(IComponent component) : base(component) { imageListView = (ImageListView)component; designerService = (DesignerActionUIService)GetService(typeof(DesignerActionUIService)); }
/// <summary> /// Initializes a new instance of the <see cref="ImageListViewCacheThumbnail"/> class. /// </summary> /// <param name="owner">The owner control.</param> public ImageListViewCacheThumbnail(ImageListView owner) { context = null; bw = new QueuedBackgroundWorker(); bw.ProcessingMode = ProcessingMode.LIFO; bw.IsBackground = true; bw.DoWork += bw_DoWork; bw.RunWorkerCompleted += bw_RunWorkerCompleted; checkProcessingCallback = new SendOrPostCallback(CanContinueProcessing); mImageListView = owner; CacheMode = CacheMode.OnDemand; CacheLimitAsItemCount = 0; CacheLimitAsMemory = 20 * 1024 * 1024; RetryOnError = false; thumbCache = new Dictionary<Guid, CacheItem>(); editCache = new Dictionary<Guid, bool>(); processing = new Dictionary<Guid, bool>(); processingRendererItem = Guid.Empty; processingGalleryItem = Guid.Empty; rendererItem = null; galleryItem = null; MemoryUsed = 0; MemoryUsedByRemoved = 0; removedItems = new List<Guid>(); disposed = false; }
/// <summary> /// Initializes a new instance of the ImageListViewColumnHeader class. /// </summary> /// <param name="type">The type of data to display in this column.</param> /// <param name="text">Text of the column header.</param> /// <param name="width">Width in pixels of the column header.</param> public ImageListViewColumnHeader(ColumnType type, string text, int width) { mImageListView = null; owner = null; mText = text; mType = type; mWidth = width; mVisible = true; mDisplayIndex = -1; }
/// <summary> /// Initializes a new instance of the ImageListViewLayoutManager class. /// </summary> /// <param name="owner">The owner control.</param> public ImageListViewLayoutManager(ImageListView owner) { mImageListView = owner; cachedVisibleItems = new Dictionary<Guid, bool>(); vScrollVisible = false; hScrollVisible = false; Update(); }
/// <summary> /// Initializes a new instance of the ImageListViewColumnHeader class. /// </summary> /// <param name="type">The type of data to display in this column.</param> /// <param name="text">Text of the column header.</param> /// <param name="width">Width in pixels of the column header.</param> /// <param name="displayIndex">Display order of the column.</param> /// <param name="visible">Whether the column is initially visible.</param> public ImageListViewColumnHeader(ColumnType type, string text, int width, int displayIndex, bool visible) { mImageListView = null; owner = null; mGuid = Guid.NewGuid(); mText = text; mType = type; mWidth = width; mVisible = visible; mDisplayIndex = displayIndex; }
/// <summary> /// Initializes a new instance of the <see cref="ImageListViewCacheShellInfo"/> class. /// </summary> /// <param name="owner">The owner control.</param> public ImageListViewCacheShellInfo(ImageListView owner) { context = null; bw = new QueuedBackgroundWorker (); bw.Threads = 1; bw.IsBackground = true; bw.DoWork += bw_DoWork; bw.RunWorkerCompleted += bw_RunWorkerCompleted; checkProcessingCallback = new SendOrPostCallback (CanContinueProcessing); mImageListView = owner; RetryOnError = false; shellCache = new Dictionary<string, CacheItem> (); processing = new Dictionary<string, bool> (); disposed = false; }
/// <summary> /// Initializes a new instance of the <see cref="ImageListViewCacheShellInfo"/> class. /// </summary> /// <param name="owner">The owner control.</param> public ImageListViewCacheMetadata(ImageListView owner) { context = null; bw = new QueuedBackgroundWorker (); bw.IsBackground = true; bw.DoWork += bw_DoWork; bw.RunWorkerCompleted += bw_RunWorkerCompleted; checkProcessingCallback = new SendOrPostCallback (CanContinueProcessing); mImageListView = owner; RetryOnError = false; editCache = new Dictionary<Guid, bool> (); processing = new Dictionary<Guid, bool> (); removedItems = new Dictionary<Guid, bool> (); disposed = false; }
/// <summary> /// Initializes a new instance of the ImageListViewItemCacheManager class. /// </summary> /// <param name="owner">The owner control.</param> public ImageListViewItemCacheManager(ImageListView owner) { lockObject = new object(); mImageListView = owner; toCache = new Queue<CacheItem>(); editCache = new Dictionary<Guid, bool>(); mThread = new Thread(new ThreadStart(DoWork)); mThread.IsBackground = true; stopping = false; stopped = false; disposed = false; mThread.Start(); while (!mThread.IsAlive) ; }
/// <summary> /// Initializes a new instance of the ColumnHoverEventArgs class. /// </summary> /// <param name="column">The currently hovered column.</param> /// <param name="previousColumn">The previously hovered column.</param> public ColumnHoverEventArgs(ImageListView.ImageListViewColumnHeader column, ImageListView.ImageListViewColumnHeader previousColumn) { Column = column; PreviousColumn = previousColumn; }
/// <summary> /// Initializes a new instance of the ColumnEventArgs class. /// </summary> /// <param name="column">The column that is the target of this event.</param> public ColumnEventArgs(ImageListView.ImageListViewColumnHeader column) { Column = column; }
/// <summary> /// Initializes a new instance of the ColumnClickEventArgs class. /// </summary> /// <param name="column">The column 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 ColumnClickEventArgs(ImageListView.ImageListViewColumnHeader column, Point location, MouseButtons buttons) { Column = column; Location = location; Buttons = buttons; }
/// <summary> /// Draws the column headers. /// </summary> /// <param name="g">The System.Drawing.Graphics to draw on.</param> /// <param name="column">The ImageListViewColumnHeader to draw.</param> /// <param name="state">The current view state of column.</param> /// <param name="bounds">The bounding rectangle of column in client coordinates.</param> public override void DrawColumnHeader(Graphics g, ImageListView.ImageListViewColumnHeader column, ColumnState state, Rectangle bounds) { // Paint background if (mImageListView.Focused && ((state & ColumnState.Hovered) == ColumnState.Hovered)) { using (Brush bHovered = new LinearGradientBrush(bounds, Color.FromArgb(64, 96, 144, 240), Color.FromArgb(196, 96, 144, 240), LinearGradientMode.Vertical)) { g.FillRectangle(bHovered, bounds); } } else { using (Brush bNormal = new LinearGradientBrush(bounds, Color.FromArgb(32, 128, 128, 128), Color.FromArgb(196, 128, 128, 128), LinearGradientMode.Vertical)) { g.FillRectangle(bNormal, bounds); } } using (Brush bBorder = new LinearGradientBrush(bounds, Color.FromArgb(96, 128, 128, 128), Color.FromArgb(128, 128, 128), LinearGradientMode.Vertical)) using (Pen pBorder = new Pen(bBorder)) { g.DrawLine(pBorder, bounds.Left, bounds.Top, bounds.Left, bounds.Bottom); g.DrawLine(pBorder, bounds.Left, bounds.Bottom - 1, bounds.Right, bounds.Bottom - 1); } using (Pen pen = new Pen(Color.FromArgb(16, Color.White))) { g.DrawLine(pen, bounds.Left + 1, bounds.Top + 1, bounds.Left + 1, bounds.Bottom - 2); g.DrawLine(pen, bounds.Right - 1, bounds.Top + 1, bounds.Right - 1, bounds.Bottom - 2); } // Draw the sort arrow int textOffset = 4; if (mImageListView.SortOrder != SortOrder.None && mImageListView.SortColumn == column.Type) { Image img = null; if (mImageListView.SortOrder == SortOrder.Ascending) img = ImageListViewResources.SortAscending; else if (mImageListView.SortOrder == SortOrder.Descending) img = ImageListViewResources.SortDescending; g.DrawImageUnscaled(img, bounds.X + 4, bounds.Top + (bounds.Height - img.Height) / 2); textOffset += img.Width; } // Text bounds.X += textOffset; bounds.Width -= textOffset; if (bounds.Width > 4) { using (StringFormat sf = new StringFormat()) { sf.FormatFlags = StringFormatFlags.NoWrap; sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Center; sf.Trimming = StringTrimming.EllipsisCharacter; using (Brush brush = new SolidBrush(Color.White)) { g.DrawString(column.Text, (mImageListView.HeaderFont == null ? mImageListView.Font : mImageListView.HeaderFont), brush, bounds, sf); } } } }
/// <summary> /// Adds the virtual item image to the renderer cache queue. /// </summary> /// <param name="guid">The guid representing this item.</param> /// <param name="adaptor">The adaptor of this item.</param> /// <param name="key">The key of this item.</param> /// <param name="thumbSize">Requested thumbnail size.</param> /// <param name="useEmbeddedThumbnails">UseEmbeddedThumbnails property of the owner control.</param> /// <param name="autoRotate">AutoRotate property of the owner control.</param> /// <param name="useWIC">Whether to use WIC.</param> public void AddToRendererCache(Guid guid, ImageListView.ImageListViewItemAdaptor adaptor, object key, Size thumbSize, UseEmbeddedThumbnails useEmbeddedThumbnails, bool autoRotate, bool useWIC) { // Already cached? if (rendererItem != null && rendererItem.Guid == guid && rendererItem.Image != null && rendererItem.Size == thumbSize && rendererItem.UseEmbeddedThumbnails == useEmbeddedThumbnails && rendererItem.AutoRotate == autoRotate && rendererItem.UseWIC == useWIC) return; // Add to cache queue RunWorker(new CacheRequest(guid, adaptor, key, thumbSize, useEmbeddedThumbnails, autoRotate, useWIC, RequestType.Renderer), 1); }
/// <summary> /// Draws the column headers. /// </summary> /// <param name="g">The System.Drawing.Graphics to draw on.</param> /// <param name="column">The ImageListViewColumnHeader to draw.</param> /// <param name="state">The current view state of column.</param> /// <param name="bounds">The bounding rectangle of column in client coordinates.</param> public override void DrawColumnHeader(Graphics g, ImageListView.ImageListViewColumnHeader column, ColumnState state, Rectangle bounds) { // Paint background if ((state & ColumnState.Hovered) != ColumnState.None) { using (Brush bHovered = new LinearGradientBrush(bounds, ImageListView.Colors.ColumnHeaderHoverColor1, ImageListView.Colors.ColumnHeaderHoverColor2, LinearGradientMode.Vertical)) { g.FillRectangle(bHovered, bounds); } } else { using (Brush bNormal = new LinearGradientBrush(bounds, ImageListView.Colors.ColumnHeaderBackColor1, ImageListView.Colors.ColumnHeaderBackColor2, LinearGradientMode.Vertical)) { g.FillRectangle(bNormal, bounds); } } using (Pen pBorder = new Pen(ImageListView.Colors.ColumnSeparatorColor)) { g.DrawLine(pBorder, bounds.Left, bounds.Top, bounds.Left, bounds.Bottom); g.DrawLine(pBorder, bounds.Left, bounds.Bottom - 1, bounds.Right, bounds.Bottom - 1); } using (Pen pBorder = new Pen(Color.FromArgb(252, 252, 252))) { g.DrawRectangle(pBorder, bounds.Left + 1, bounds.Top, bounds.Width - 2, bounds.Height - 2); } // Draw the sort arrow int offset = 4; int width = bounds.Width - 2 * offset; if (ImageListView.SortOrder != SortOrder.None && ((state & ColumnState.SortColumn) != ColumnState.None)) { Image img = null; if (ImageListView.SortOrder == SortOrder.Ascending) img = ImageListViewResources.SortAscending; else if (ImageListView.SortOrder == SortOrder.Descending) img = ImageListViewResources.SortDescending; if (img != null) { g.DrawImageUnscaled(img, bounds.Right - offset - img.Width, bounds.Top + (bounds.Height - img.Height) / 2); width -= img.Width + offset; } } // Text bounds.X += offset; bounds.Width = width; if (bounds.Width > 4) { using (StringFormat sf = new StringFormat()) { sf.FormatFlags = StringFormatFlags.NoWrap; sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Center; sf.Trimming = StringTrimming.EllipsisCharacter; using (SolidBrush bText = new SolidBrush(ImageListView.Colors.ColumnHeaderForeColor)) { g.DrawString(column.Text, (ImageListView.ColumnHeaderFont == null ? ImageListView.Font : ImageListView.ColumnHeaderFont), bText, bounds, sf); } } } }
/// <summary> /// Adds the item to the cache queue. /// </summary> /// <param name="guid">Item guid.</param> /// <param name="adaptor">The adaptor for this item.</param> /// <param name="virtualItemKey">The virtual item key.</param> /// <param name="useWIC">Whether to use the Windows Imaging Component.</param> public void Add(Guid guid, ImageListView.ImageListViewItemAdaptor adaptor, object virtualItemKey, bool useWIC) { // Add to cache queue RunWorker (new CacheRequest (guid, adaptor, virtualItemKey, useWIC)); }
/// <summary> /// Initializes a new instance of the <see cref="CacheRequest"/> class /// for use with a virtual item. /// </summary> /// <param name="guid">The guid of the ImageListViewItem.</param> /// <param name="adaptor">The adaptor of this item.</param> /// <param name="key">The public key for the virtual item.</param> /// <param name="size">The size of the requested thumbnail.</param> /// <param name="useEmbeddedThumbnails">UseEmbeddedThumbnails property of the owner control.</param> /// <param name="autoRotate">AutoRotate property of the owner control.</param> /// <param name="useWIC">Whether to use WIC.</param> /// <param name="requestType">Type of this request.</param> public CacheRequest(Guid guid, ImageListView.ImageListViewItemAdaptor adaptor, object key, Size size, UseEmbeddedThumbnails useEmbeddedThumbnails, bool autoRotate, bool useWIC, RequestType requestType) { Guid = guid; VirtualItemKey = key; Adaptor = adaptor; Size = size; UseEmbeddedThumbnails = useEmbeddedThumbnails; AutoRotate = autoRotate; UseWIC = useWIC; RequestType = requestType; }
public DemoForm() { try { // LicenceController n'était pas présent dans le projet (tu as peut être oublié de l'inclure dans l'import initial du projet ?) // bref, du coup j'ai retiré la référence à la classe dans le projet // et forcément, ben faut que je mette en commentaire cette partie... /* LicenceControler lc = new LicenceControler(); if (lc.licenceOk == false) { Environment.Exit(1); } */ VersionChecker vc = new VersionChecker(); string netresult = vc.GetNetworkVersion(); int versionMajor = 0; int versionMineur = 9; char[] separator = new char[1]; separator[0] = '.'; string[] splitString = netresult.Split(separator); if (splitString.Length == 2) { if (Int32.Parse(splitString[0].ToString()) >= versionMajor && Int32.Parse(splitString[1].ToString()) > versionMineur) { if (MessageBox.Show("New version is available , do you want to download it ? ", "Update", System.Windows.Forms.MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK) { vc.DownloadFile(); } } } } catch (Exception e) { } InitializeComponent(); currentImageListView = imageListView1; // Setup the background worker Application.Idle += new EventHandler(Application_Idle); //bw.DoWork += new DoWorkEventHandler(bw_DoWork); //bw.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); } imageListView1.AllowDuplicateFileNames = true; imageListView1.SetRenderer(new ImageListViewRenderers.DefaultRenderer()); /* TreeNode node = new TreeNode("Loading...", 3, 3); node.Tag = null; treeView1.Nodes.Clear(); treeView1.Nodes.Add(node); while (bw.IsBusy) ; bw.RunWorkerAsync(node); */ fillTree(); showCustomerLeavingTomorrow(); if (GlobalConfig.getInstance() != null) { this.Text = "PHotos Maurice" + GlobalConfig.getInstance().communConfig; } }
/// <summary> /// Updates group order and name of the item. /// </summary> /// <param name="column">The group column.</param> internal void UpdateGroup(ImageListView.ImageListViewColumnHeader column) { if (column == null) { groupOrder = 0; group = string.Empty; return; } Utility.Tuple<int, string> groupInfo = new Utility.Tuple<int, string>(0, string.Empty); switch (column.Type) { case ColumnType.DateAccessed: groupInfo = Utility.GroupTextDate(DateAccessed); break; case ColumnType.DateCreated: groupInfo = Utility.GroupTextDate(DateCreated); break; case ColumnType.DateModified: groupInfo = Utility.GroupTextDate(DateModified); break; case ColumnType.Dimensions: groupInfo = Utility.GroupTextDimension(Dimensions); break; case ColumnType.FileName: groupInfo = Utility.GroupTextAlpha(FileName); break; case ColumnType.FilePath: groupInfo = Utility.GroupTextAlpha(FilePath); break; case ColumnType.FolderName: groupInfo = Utility.GroupTextAlpha(FolderName); break; case ColumnType.FileSize: groupInfo = Utility.GroupTextFileSize(FileSize); break; case ColumnType.FileType: groupInfo = Utility.GroupTextAlpha(FileType); break; case ColumnType.Name: groupInfo = Utility.GroupTextAlpha(Text); break; case ColumnType.ImageDescription: groupInfo = Utility.GroupTextAlpha(ImageDescription); break; case ColumnType.EquipmentModel: groupInfo = Utility.GroupTextAlpha(EquipmentModel); break; case ColumnType.DateTaken: groupInfo = Utility.GroupTextDate(DateTaken); break; case ColumnType.Artist: groupInfo = Utility.GroupTextAlpha(Artist); break; case ColumnType.Copyright: groupInfo = Utility.GroupTextAlpha(Copyright); break; case ColumnType.UserComment: groupInfo = Utility.GroupTextAlpha(UserComment); break; case ColumnType.Software: groupInfo = Utility.GroupTextAlpha(Software); break; case ColumnType.Custom: groupInfo = Utility.GroupTextAlpha(GetSubItemText(column.Guid)); break; case ColumnType.ISOSpeed: groupInfo = new Utility.Tuple<int, string>(ISOSpeed, ISOSpeed.ToString()); break; case ColumnType.Rating: groupInfo = new Utility.Tuple<int, string>(Rating / 5, (Rating / 5).ToString()); break; case ColumnType.FocalLength: groupInfo = new Utility.Tuple<int, string>((int)FocalLength, FocalLength.ToString()); break; case ColumnType.ExposureTime: groupInfo = new Utility.Tuple<int, string>((int)ExposureTime, ExposureTime.ToString()); break; case ColumnType.FNumber: groupInfo = new Utility.Tuple<int, string>((int)FNumber, FNumber.ToString()); break; case ColumnType.Resolution: groupInfo = new Utility.Tuple<int, string>((int)Resolution.Width, Resolution.Width.ToString()); break; default: groupInfo = new Utility.Tuple<int, string>(0, "Unknown"); break; } groupOrder = groupInfo.Item1; group = groupInfo.Item2; }
public FlickrInfoAdapter(ImageListView view) { _view = view; }
private bool DeleteFiles(ImageListView imgListView,bool iscategory=false) { ImageListView.ImageListViewSelectedItemCollection selected = imgListView.SelectedItems; // On multiplie par deux pour les images et miniatures. String[] files; List<String> imgFile = new List<string>(); try { foreach (ImageListViewItem img in selected) { imgFile.Add(img.FileName); FileInfo fi = new FileInfo(img.FileName); FileInfo fiMiniature = new FileInfo(DirUtil.JoinDirAndFile(fi.DirectoryName, "miniatures/") + fi.Name); if (fiMiniature.Exists && iscategory) { imgFile.Add(DirUtil.JoinDirAndFile(fi.DirectoryName, "miniatures/") + fi.Name); } } files = new string[imgFile.Count]; for (int n = 0; n < imgFile.Count; n++) { files[n] = imgFile[n]; } ShellFileOperation sfo = new ShellFileOperation(); sfo.SourceFiles = files; sfo.Operation = ShellFileOperation.FileOperations.FO_DELETE; return sfo.DoOperation(); } catch (Exception e) { MessageBox.Show(" Error deleting \n " + e.Message); } return false; }
/// <summary> /// Draws the column headers. /// </summary> /// <param name="g">The System.Drawing.Graphics to draw on.</param> /// <param name="column">The ImageListViewColumnHeader to draw.</param> /// <param name="state">The current view state of column.</param> /// <param name="bounds">The bounding rectangle of column in client coordinates.</param> public override void DrawColumnHeader(Graphics g, ImageListView.ImageListViewColumnHeader column, ColumnState state, Rectangle bounds) { SortOrder order = SortOrder.None; if (ImageListView.SortOrder != SortOrder.None && ((state & ColumnState.SortColumn) != ColumnState.None)) order = ImageListView.SortOrder; VisualStyleRenderer rBack; if (((state & ColumnState.Hovered) == ColumnState.Hovered) && order != SortOrder.None) rBack = rColumnSortedHovered; else if (((state & ColumnState.Hovered) == ColumnState.Hovered) && order == SortOrder.None) rBack = rColumnHovered; else if (((state & ColumnState.Hovered) == ColumnState.None) && order != SortOrder.None) rBack = rColumnSorted; else rBack = rColumnNormal; VisualStyleRenderer rSort; if (order == SortOrder.Ascending || order == SortOrder.AscendingNatural) rSort = rSortAscending; else rSort = rSortDescending; // Background if (VisualStylesEnabled && rBack != null && rSort != null) { // Background rBack.DrawBackground(g, bounds, bounds); // Sort arrow if (order != SortOrder.None) { Size sz = rSort.GetPartSize(g, System.Windows.Forms.VisualStyles.ThemeSizeType.True); Rectangle sortBounds = new Rectangle(new Point(0, 0), sz); sortBounds.Offset(bounds.X + (bounds.Width - sz.Width) / 2, 0); rSort.DrawBackground(g, sortBounds, sortBounds); } // Text if (bounds.Width > 4) { Rectangle textBounds = bounds; textBounds.Inflate(-3, 0); TextRenderer.DrawText(g, column.Text, SystemFonts.MenuFont, textBounds, SystemColors.ControlText, TextFormatFlags.EndEllipsis | TextFormatFlags.VerticalCenter | TextFormatFlags.SingleLine | TextFormatFlags.PreserveGraphicsClipping); } } else base.DrawColumnHeader(g, column, state, bounds); }
internal ImageListViewFilter(ImageListView view, ImageListView.ImageListViewItemAdaptor adaptor) { mAdaptor = adaptor; mImageListView = view; mLastSearch = ""; }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { toolStrip1.Visible = false; if (e.Node.GetType().Name == "NodesCategory") { tabControl1.SelectedIndex = 1; } if (e.Node.GetType().Name == "NodeCategory") { tabControl1.SelectedIndex = 0; NodeCategory node = (NodeCategory)e.Node; try { PopulateListView(new DirectoryInfo(node.getDirectory())); } catch (Exception exp) { MessageBox.Show("Error in category " + exp.Message); } FillGuiCategory(node); currentImageListView = imageListView1; toolStrip1.Visible = true; } if (e.Node.GetType().Name == "NodeUser") { buttonPrint.Visible = false; buttonCash.Visible = true; tabControl1.SelectedIndex = 2; NodeUser node = (NodeUser)e.Node; node.refresh(); PopulateListViewCustomer(SHOWPICTURE.ALL); FillGuiCustomer(node); currentImageListView = imageListView2; toolStrip1.Visible = true; } if (e.Node.GetType().Name == "NodesUser") { tabControl1.SelectedIndex = 3; // Blanck } if (e.Node.GetType().Name == "NodesPhotographer") { tabControl1.SelectedIndex = 4; } if (e.Node.GetType().Name == "NodePhotographer") { tabControl1.SelectedIndex = 5; NodePhotographer node = (NodePhotographer) e.Node; FillInfoPhotoGraphe(node); } if (e.Node.GetType().Name == "NodesInfo") { tabControl1.SelectedIndex = 6; } if (e.Node.GetType().Name == "NodeInfo") { NodeInfo node = (NodeInfo)e.Node; FillGuiInfo(node); tabControl1.SelectedIndex = 7; // Blanck } if (e.Node.GetType().Name == "NodeConfig") { NodeConfig node = (NodeConfig)e.Node; FillGuiConfig(node); tabControl1.SelectedIndex = 8; } if (e.Node.GetType().Name == "NodePrice") { VerySimpleInputDialog login = new VerySimpleInputDialog("Please Enter Password"); if (login.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (login.UserInput == "maurice") { NodePrice node = (NodePrice)e.Node; FillGuiPrice(node); tabControl1.SelectedIndex = 9; } else { MessageBox.Show("Bad Password"); } } } //@"C:\Users\c\Pictures")); //if (e.Node.Tag == null) return; //KeyValuePair<DirectoryInfo, bool> ktag = (KeyValuePair<DirectoryInfo, bool>)e.Node.Tag; //PopulateListView(ktag.Key); }
/// <summary> /// Adds a virtual item to the cache queue. /// </summary> /// <param name="guid">The guid representing this item.</param> /// <param name="adaptor">he adaptor for this item.</param> /// <param name="key">The key of this item.</param> /// <param name="thumbSize">Requested thumbnail size.</param> /// <param name="useEmbeddedThumbnails">UseEmbeddedThumbnails property of the owner control.</param> /// <param name="autoRotate">AutoRotate property of the owner control.</param> /// <param name="useWIC">Whether to use WIC.</param> public void Add(Guid guid, ImageListView.ImageListViewItemAdaptor adaptor, object key, Size thumbSize, UseEmbeddedThumbnails useEmbeddedThumbnails, bool autoRotate, bool useWIC) { // Already cached? CacheItem item = null; if (thumbCache.TryGetValue(guid, out item)) { if (item.Size == thumbSize && item.UseEmbeddedThumbnails == useEmbeddedThumbnails) return; } // Add to cache queue RunWorker(new CacheRequest(guid, adaptor, key, thumbSize, useEmbeddedThumbnails, autoRotate, useWIC, RequestType.Thumbnail)); }
/// <summary> /// Adds a virtual item to the cache. /// </summary> /// <param name="guid">The guid representing this item.</param> /// <param name="adaptor">The adaptor for this item.</param> /// <param name="key">The key of this item.</param> /// <param name="thumbSize">Requested thumbnail size.</param> /// <param name="thumb">Thumbnail image to add to cache.</param> /// <param name="useEmbeddedThumbnails">UseEmbeddedThumbnails property of the owner control.</param> /// <param name="autoRotate">AutoRotate property of the owner control.</param> /// <param name="useWIC">Whether to use WIC.</param> public void Add(Guid guid, ImageListView.ImageListViewItemAdaptor adaptor, object key, Size thumbSize, Image thumb, UseEmbeddedThumbnails useEmbeddedThumbnails, bool autoRotate, bool useWIC) { // Already cached? CacheItem item = null; if (thumbCache.TryGetValue(guid, out item)) { if (item.Size == thumbSize && item.UseEmbeddedThumbnails == useEmbeddedThumbnails) return; } // Resize only when thumb is too large in size if (thumb.Width > thumbSize.Width || thumb.Height > thumbSize.Height) { thumb = ThumbnailExtractor.FromImage(thumb, thumbSize, useEmbeddedThumbnails, autoRotate, useWIC); } // Add to cache thumbCache.Add(guid, new CacheItem(guid, thumbSize, thumb, 0, CacheState.Cached, useEmbeddedThumbnails, autoRotate, useWIC)); // Add to disk cache //using (MemoryStream stream = new MemoryStream()) //{ // string diskCacheKey = adaptor.GetUniqueIdentifier(key, thumbSize, useEmbeddedThumbnails, autoRotate, useWIC); // thumb.Save(stream, System.Drawing.Imaging.ImageFormat.Png); // diskCache.Write(diskCacheKey, stream); //} // Raise the cache events if (mImageListView != null) { mImageListView.OnThumbnailCachedInternal(guid, thumb, thumbSize, true); mImageListView.Refresh(); } }
/// <summary> /// Adds a virtual item to the cache. /// </summary> /// <param name="guid">The guid representing this item.</param> /// <param name="adaptor">The adaptor for this item.</param> /// <param name="key">The key of this item.</param> /// <param name="thumbSize">Requested thumbnail size.</param> /// <param name="thumb">Thumbnail image to add to cache.</param> /// <param name="useEmbeddedThumbnails">UseEmbeddedThumbnails property of the owner control.</param> /// <param name="autoRotate">AutoRotate property of the owner control.</param> /// <param name="useWIC">Whether to use WIC.</param> public void Add(Guid guid, ImageListView.ImageListViewItemAdaptor adaptor, object key, Size thumbSize, Image thumb, UseEmbeddedThumbnails useEmbeddedThumbnails, bool autoRotate, bool useWIC) { // Already cached? CacheItem item = null; if (thumbCache.TryGetValue(guid, out item)) { if (item.Size == thumbSize && item.UseEmbeddedThumbnails == useEmbeddedThumbnails) return; } // Add to cache thumbCache.Add(guid, new CacheItem(guid, thumbSize, ThumbnailExtractor.FromImage(thumb, thumbSize, useEmbeddedThumbnails, autoRotate, useWIC), CacheState.Cached, useEmbeddedThumbnails, autoRotate, useWIC)); // Raise the cache events if (mImageListView != null) { mImageListView.OnThumbnailCachedInternal(guid, thumb, thumbSize, true); mImageListView.Refresh(); } }