public void displayCopiedFiles(CopyItems cis) { listView1.Clear(); imageList1.Images.Clear(); ListViewItem item; listView1.BeginUpdate(); string key; for (int i = 0; i < cis.count(); i++) { CopyItem ci = cis.get(i); string path = ci.Path; if (ci.isFile) { System.IO.FileInfo file = new System.IO.FileInfo(path); key = file.Extension; if (key == ".lnk") { key = file.Name + key; } } else { key = path; } // Set a default icon for the file. Icon iconForFile = SystemIcons.WinLogo; //item = new ListViewItem(file.Name, 1); item = new ListViewItem(ci.Name, 1); // Check to see if the image collection contains an image // for this extension, using the extension as a key. if (!imageList1.Images.ContainsKey(key)) { // If not, add the image to the image list. if (ci.isFile) { iconForFile = System.Drawing.Icon.ExtractAssociatedIcon(path); } else { iconForFile = ExtractFromPath(path); } imageList1.Images.Add(key, iconForFile); } item.ImageKey = key; item.Name = path; listView1.Items.Add(item); } listView1.EndUpdate(); }
public override bool Equals(object obj) { if (this.GetType() != obj.GetType()) { return(false); } CopyItems cis = (CopyItems)obj; if (cis.count() != count()) { return(false); } foreach (CopyItem ci in cis.items) { if (!items.Contains(ci)) { return(false); } } return(true); }
public void config() { //0 space between this control and its neighbours. Margin = new Padding(0, 0, 0, 0); BackgroundImageLayout = ImageLayout.Stretch; BackgroundImage = Properties.Resources.windowCaseOffBlue; titleLbl.BackColor = System.Drawing.Color.Transparent; titleLbl.Text = $"{copyItems.count()} {copyItems.CopiedDate.ToString()}"; titleLbl.ForeColor = System.Drawing.SystemColors.ButtonHighlight; MouseDown += CopyItemsCtl_MouseDown; titleLbl.MouseDown += CopyItemsCtl_MouseDown; ToolTip tt = new ToolTip(); titleLbl.MouseHover += new EventHandler((object sender, EventArgs e) => { tt.Show(titleLbl.Text, titleLbl, 5000); }); titleLbl.Click += new EventHandler((object sender, EventArgs e) => { ClickEventHandler?.Invoke(this, copyItems); }); Click += new EventHandler((object sender, EventArgs e) => { ClickEventHandler?.Invoke(sender, copyItems); }); /* addWindowPic.Click += addWinPicClicked; * addWindowPic.MouseEnter += new EventHandler((object sender, EventArgs e) => * { * addWindowPic.setImage(true); * BackgroundImage = Resource1.windowCaseOnBlue; * }); * addWindowPic.MouseLeave += new EventHandler((object sender, EventArgs e) => * { * addWindowPic.setImage(); * BackgroundImage = Resource1.windowCaseOffBlue; * });*/ //MouseUp += windowItemShowMenu; ////windowIconPic.MouseUp += windowItemShowMenu; // windowTitleLbl.MouseUp += windowItemShowMenu; MouseEnter += new EventHandler((object sender, EventArgs e) => { BackgroundImage = Properties.Resources.windowCaseOnBlue; }); MouseLeave += new EventHandler((object sender, EventArgs e) => { BackgroundImage = Properties.Resources.windowCaseOffBlue; }); /* windowIconPic.MouseEnter += new EventHandler((object sender, EventArgs e) => * { * BackgroundImage = Resource1.windowCaseOnBlue; * });*/ titleLbl.MouseEnter += new EventHandler((object sender, EventArgs e) => { BackgroundImage = Properties.Resources.windowCaseOnBlue; }); titleLbl.MouseMove += CopyItemsCtl_MouseMove; titleLbl.MouseUp += CopyItemsCtl_MouseUp; MouseMove += CopyItemsCtl_MouseMove; MouseUp += CopyItemsCtl_MouseUp; removePic.MouseEnter += new EventHandler((object sender, EventArgs e) => { removePic.BackgroundImage = Properties.Resources.closeOn; Cursor = Cursors.Hand; }); removePic.MouseLeave += new EventHandler((object sender, EventArgs e) => { removePic.BackgroundImage = Properties.Resources.closeOff; Cursor = Cursors.Default; }); removePic.Click += new EventHandler((object sender, EventArgs e) => { RemoveEventHandler?.Invoke(this, copyItems); }); }