public void AddControlToSubItem(Control control, EXControlListViewSubItem subitem) { this.Controls.Add(control); subitem.MyControl = control; EmbeddedControl ec; ec.MyControl = control; ec.MySubItem = subitem; this._controls.Add(ec); }
public void RemoveControlFromSubItem(EXControlListViewSubItem subitem) { Control c = subitem.MyControl; for (int i = 0; i < this._controls.Count; i++) { if (((EmbeddedControl) this._controls[i]).MySubItem == subitem) { this._controls.RemoveAt(i); subitem.MyControl = null; this.Controls.Remove(c); c.Dispose(); return; } } }
private void DisplayChap(ChapterInfo chapInfo, int chapCount) { this.Invoke((MethodInvoker)delegate { this.progess.Minimum = 1; this.progess.Value = 1; this.progess.Maximum = chapInfo.PageCount; var listItem = new EXListViewItem(chapCount.ToString()); listItem.SubItems.Add(chapInfo.Name.Replace('"',' ').Replace('.',' ')); listItem.SubItems.Add(chapInfo.PageCount.ToString()); listItem.SubItems.Add("0"); EXControlListViewSubItem cs = new EXControlListViewSubItem(); ProgressBar b = new ProgressBar(); //b.Tag = item; b.Minimum = 0; b.Maximum = chapInfo.PageCount; b.Step = 1; listItem.SubItems.Add(cs); this.listHistory.AddControlToSubItem(b, cs); //Add button to view folder EXControlListViewSubItem openFolderCol = new EXControlListViewSubItem(); Button bntOpenFolder = new Button() { Image = global::ComicDownloader.Properties.Resources._1364392872_slideshow, //Location = new System.Drawing.Point(248, 123); //Name = "button2"; Size = new System.Drawing.Size(24, 24), TextImageRelation = System.Windows.Forms.TextImageRelation.Overlay, UseVisualStyleBackColor = true, Tag = openFolderCol, //Text = chapInfo.PdfPath, Enabled = true, }; bntOpenFolder.Click += new EventHandler(delegate { MainWindow window = new MainWindow(new string[] { chapInfo.Folder+"/dum.trick","0"}); window.WindowState = FormWindowState.Maximized; window.ShowDialog(); //window.SubStartSlideShow(); }); // llbl.LinkClicked += new LinkLabelLinkClickedEventHandler(llbl_LinkClicked); listItem.SubItems.Add(openFolderCol); listHistory.AddControlToSubItem(bntOpenFolder, openFolderCol); //listItem.SubItems.Add(chapInfo.Folder); EXControlListViewSubItem pdfLinkCol = new EXControlListViewSubItem(); Button bntOpenPDF = new Button() { Image = global::ComicDownloader.Properties.Resources._1364326694_stock_save_pdf_24, //Location = new System.Drawing.Point(248, 123); //Name = "button2"; Size = new System.Drawing.Size(24, 24), TextImageRelation = System.Windows.Forms.TextImageRelation.Overlay, UseVisualStyleBackColor = true, Tag = pdfLinkCol, //Text = chapInfo.PdfPath, Enabled = false, }; bntOpenPDF.Click += new EventHandler(bntOpenPDF_Click); listItem.SubItems.Add(pdfLinkCol); listHistory.AddControlToSubItem(bntOpenPDF, pdfLinkCol); listItem.SubItems.Add(chapInfo.PdfPath); this.listHistory.Items.Add(listItem); lblPageCount.Text = string.Format("{0:D2}/{1:D2}", "0", chapInfo.PageCount); }); }