示例#1
0
        private void this_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            EXListViewItem lstvItem = this.GetItemAt(e.X, e.Y) as EXListViewItem;

            if (lstvItem == null)
            {
                return;
            }
            _clickeditem = lstvItem;
            int x = lstvItem.Bounds.Left;
            int i;

            for (i = 0; i < this.Columns.Count; i++)
            {
                x = x + this.Columns[i].Width;
                if (x > e.X)
                {
                    x = x - this.Columns[i].Width;
                    _clickedsubitem = lstvItem.SubItems[i];
                    _col            = i;
                    break;
                }
            }
            if (!(this.Columns[i] is EXColumnHeader))
            {
                return;
            }
            EXColumnHeader col = (EXColumnHeader)this.Columns[i];

            if (col.GetType() == typeof(EXEditableColumnHeader))
            {
                txtbx.Location = new Point(x, this.GetItemRect(this.Items.IndexOf(lstvItem)).Y);
                txtbx.Width    = this.Columns[i].Width;
                if (txtbx.Width > this.Width)
                {
                    txtbx.Width = this.ClientRectangle.Width;
                }
                txtbx.Text    = _clickedsubitem.Text;
                txtbx.Visible = true;
                txtbx.BringToFront();
                txtbx.Focus();
            }
            else if (col.GetType() == typeof(EXBoolColumnHeader))
            {
                EXBoolColumnHeader boolcol = (EXBoolColumnHeader)col;
                if (boolcol.Editable)
                {
                    EXBoolListViewSubItem boolsubitem = (EXBoolListViewSubItem)_clickedsubitem;
                    if (boolsubitem.BoolValue == true)
                    {
                        boolsubitem.BoolValue = false;
                    }
                    else
                    {
                        boolsubitem.BoolValue = true;
                    }
                    this.Invalidate(boolsubitem.Bounds);
                }
            }
        }
示例#2
0
	   private void _ok_Click(object sender, EventArgs e) {
		  if (User.Settings.Instance.ScanLocalPath != lbLocalDir.Checked) { this.needReScanning = true; }
		  if (User.Settings.Instance.ScanUserPath != lbUserDir.Checked) { this.needReScanning = true; }

		  if (this.needReScanning) {
			 if (MessageBox.Show("Due to the changes you made, it is necessary to reload the Start Menu.\nUnsaved work will be lost. Continue?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No) {
				this.DialogResult = DialogResult.None;
				return;
			 }
		  }

		  if (_ignoreList.Items.Count > 0) {
			 EXListViewItem[] items = new EXListViewItem[_ignoreList.Items.Count];
			 for (int i = 0; i < _ignoreList.Items.Count; i++) {
				items[i] = _ignoreList.Items[i] as EXListViewItem;
			 }
			 TemplateEditor.PersistItemChanges(items);
		  }

		  string[] addtPaths = new string[lstAddtPaths.Items.Count];
		  for (int i = 0; i < lstAddtPaths.Items.Count; i++) {
			 addtPaths[i] = lstAddtPaths.Items[i].Text;
			 if (!addtPaths[i].EndsWith(Path.DirectorySeparatorChar.ToString())) { addtPaths[i] += Path.DirectorySeparatorChar; }
		  }
		  
		  User.Settings.Instance.AdditionalPaths = addtPaths;
		  User.Settings.Instance.ScanLocalPath = lbLocalDir.Checked;
		  User.Settings.Instance.ScanUserPath = lbUserDir.Checked;
		  User.Settings.Save();
	   }
示例#3
0
        // Token: 0x0600002F RID: 47 RVA: 0x00003114 File Offset: 0x00001314
        private void this_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
        {
            e.DrawBackground();
            if (e.ColumnIndex == this._sortcol)
            {
                e.Graphics.FillRectangle(this._sortcolbrush, e.Bounds);
            }
            if ((e.ItemState & ListViewItemStates.Selected) != (ListViewItemStates)0)
            {
                e.Graphics.FillRectangle(this._highlightbrush, e.Bounds);
            }
            int fonty = e.Bounds.Y + e.Bounds.Height / 2 - e.SubItem.Font.Height / 2;
            int x     = e.Bounds.X + 2;

            if (e.ColumnIndex == 0)
            {
                EXListViewItem item = (EXListViewItem)e.Item;
                if (item.GetType() == typeof(EXImageListViewItem))
                {
                    EXImageListViewItem imageitem = (EXImageListViewItem)item;
                    if (imageitem.MyImage != null)
                    {
                        Image img  = imageitem.MyImage;
                        int   imgy = e.Bounds.Y + e.Bounds.Height / 2 - img.Height / 2;
                        e.Graphics.DrawImage(img, x, imgy, img.Width, img.Height);
                        x += img.Width + 2;
                    }
                }
                e.Graphics.DrawString(e.SubItem.Text, e.SubItem.Font, new SolidBrush(e.SubItem.ForeColor), (float)x, (float)fonty);
            }
            else
            {
                EXListViewSubItemAB subitem = e.SubItem as EXListViewSubItemAB;
                if (subitem == null)
                {
                    e.DrawDefault = true;
                }
                else
                {
                    x = subitem.DoDraw(e, x, base.Columns[e.ColumnIndex] as EXColumnHeader);
                    e.Graphics.DrawString(e.SubItem.Text, e.SubItem.Font, new SolidBrush(e.SubItem.ForeColor), (float)x, (float)fonty);
                }
            }
        }
示例#4
0
        private void this_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            EXListViewItem lstvItem = this.GetItemAt(e.X, e.Y) as EXListViewItem;

            if (lstvItem == null)
            {
                return;
            }
            _clickeditem = lstvItem;
            int x = lstvItem.Bounds.Left;
            int i;

            for (i = 0; i < this.Columns.Count; i++)
            {
                x = x + this.Columns[i].Width;
                if (x > e.X)
                {
                    x = x - this.Columns[i].Width;
                    _clickedsubitem = lstvItem.SubItems[i];
                    _col            = i;
                    break;
                }
            }
            if (!(this.Columns[i] is EXColumnHeader))
            {
                return;
            }
            EXColumnHeader col = (EXColumnHeader)this.Columns[i];

            if (col.GetType() == typeof(EXEditableColumnHeader))
            {
                EXEditableColumnHeader editcol = (EXEditableColumnHeader)col;
                if (editcol.MyControl != null)
                {
                    Control c = editcol.MyControl;
                    if (c.Tag != null)
                    {
                        this.Controls.Add(c);
                        c.Tag = null;
                        if (c is ComboBox)
                        {
                            ((ComboBox)c).SelectedValueChanged += new EventHandler(cmbx_SelectedValueChanged);
                        }
                        c.Leave += new EventHandler(c_Leave);
                    }
                    c.Location = new Point(x, this.GetItemRect(this.Items.IndexOf(lstvItem)).Y);
                    c.Width    = this.Columns[i].Width;
                    if (c.Width > this.Width)
                    {
                        c.Width = this.ClientRectangle.Width;
                    }
                    c.Text    = _clickedsubitem.Text;
                    c.Visible = true;
                    c.BringToFront();
                    c.Focus();
                }
                else
                {
                    txtbx.Location = new Point(x, this.GetItemRect(this.Items.IndexOf(lstvItem)).Y);
                    txtbx.Width    = this.Columns[i].Width;
                    if (txtbx.Width > this.Width)
                    {
                        txtbx.Width = this.ClientRectangle.Width;
                    }
                    txtbx.Text    = _clickedsubitem.Text;
                    txtbx.Visible = true;
                    txtbx.BringToFront();
                    txtbx.Focus();
                }
            }
            else if (col.GetType() == typeof(EXBoolColumnHeader))
            {
                EXBoolColumnHeader boolcol = (EXBoolColumnHeader)col;
                if (boolcol.Editable)
                {
                    EXBoolListViewSubItem boolsubitem = (EXBoolListViewSubItem)_clickedsubitem;
                    if (boolsubitem.BoolValue == true)
                    {
                        boolsubitem.BoolValue = false;
                    }
                    else
                    {
                        boolsubitem.BoolValue = true;
                    }
                    this.Invalidate(boolsubitem.Bounds);
                }
            }
        }
示例#5
0
	   private void _ignoreList_SelectedIndexChanged(object sender, EventArgs e) {
		  if ((_ignoreList.SelectedItems != null) && (_ignoreList.SelectedItems.Count >= 1)) {
			 clickedItem = (EXListViewItem)_ignoreList.SelectedItems[0];
		  }
	   }
示例#6
0
	   private void _ignoreList_MouseUp(object sender, MouseEventArgs e) {
		  if (e.Button == MouseButtons.Right) {
			 clickedItem = (EXListViewItem)_ignoreList.GetItemAt(e.X, e.Y);
		  }
	   }
示例#7
0
 public void AddItem(EXListViewItem item)
 {
     m_ItemList.Add(item);
     base.Items.Add(item);
 }
示例#8
0
	   public static EXListViewItem CategoryItemToListItem(CategoryItem item, Category category, ListViewGroup group){
		  EXListViewItem newItem = new EXListViewItem(item.Value);
		  newItem.SubItems.Add(new EXListViewSubItem(item.Type.ToString()));
		  newItem.Name = item.Value;
		  newItem.TagData = item;
		  if (category != null) { newItem.SubItems.Add(new EXListViewSubItem(category.Name)); }
		  if (group != null) { newItem.Group = group; }
		  return newItem;
	   }
示例#9
0
	private void InitializeComponent() {
		//imglst_genre
		ImageList imglst_genre = new ImageList();
		imglst_genre.ColorDepth = ColorDepth.Depth32Bit;
		imglst_genre.Images.Add(Image.FromFile("music.png"));
		imglst_genre.Images.Add(Image.FromFile("love.png"));
		imglst_genre.Images.Add(Image.FromFile("comedy.png"));
		imglst_genre.Images.Add(Image.FromFile("drama.png"));
		imglst_genre.Images.Add(Image.FromFile("horror.ico"));
		imglst_genre.Images.Add(Image.FromFile("family.ico"));
		//excmbx_genre
		EXComboBox excmbx_genre = new EXComboBox();
		excmbx_genre.DropDownStyle = ComboBoxStyle.DropDownList;
		excmbx_genre.MyHighlightBrush = Brushes.Goldenrod;
		excmbx_genre.ItemHeight = 20;
		excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[0], "Music"));
		excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[1], "Romantic"));
		excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[2], "Comedy"));
		excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[3], "Drama"));
		excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[4], "Horror"));
		excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[5], "Family"));
		excmbx_genre.Items.Add(new EXComboBox.EXMultipleImagesItem(new ArrayList(new object[] {Image.FromFile("love.png"), Image.FromFile("comedy.png")}), "Romantic comedy"));
		//excmbx_rate
		EXComboBox excmbx_rate = new EXComboBox();
		excmbx_rate.MyHighlightBrush = Brushes.Goldenrod;
		excmbx_rate.DropDownStyle = ComboBoxStyle.DropDownList;
		ImageList imglst_rate = new ImageList();
		imglst_rate.ColorDepth = ColorDepth.Depth32Bit;
		imglst_rate.Images.Add(Image.FromFile("rate.png"));
		for (int i = 1; i < 6; i++) {
			ArrayList _arlst1 = new ArrayList();
			for (int j = 0; j < i; j++) {
				_arlst1.Add(imglst_rate.Images[0]);
			}
			excmbx_rate.Items.Add(new EXComboBox.EXMultipleImagesItem("", _arlst1, i.ToString()));
		}
		//lstv
		lstv = new EXListView();
		lstv.MySortBrush = SystemBrushes.ControlLight;
		lstv.MyHighlightBrush = Brushes.Goldenrod;
		lstv.GridLines = true;
		lstv.Location = new Point(10, 40);
		lstv.Size = new Size(500, 400);
		lstv.ControlPadding = 4;
		lstv.MouseMove += new MouseEventHandler(lstv_MouseMove);
		lstv.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
		//add SmallImageList to ListView - images will be shown in ColumnHeaders
		ImageList colimglst = new ImageList();
		colimglst.Images.Add("down", Image.FromFile("down.png"));
		colimglst.Images.Add("up", Image.FromFile("up.png"));
		colimglst.ColorDepth = ColorDepth.Depth32Bit;
		colimglst.ImageSize = new Size(20, 20); // this will affect the row height
		lstv.SmallImageList = colimglst;
		//add columns and items
		lstv.Columns.Add(new EXEditableColumnHeader("Movie", 20));
		lstv.Columns.Add(new EXColumnHeader("Progress", 120));
		lstv.Columns.Add(new EXEditableColumnHeader("Genre", excmbx_genre, 60));
		lstv.Columns.Add(new EXEditableColumnHeader("Rate", excmbx_rate, 100));
		lstv.Columns.Add(new EXColumnHeader("Status", 80));
		EXBoolColumnHeader boolcol = new EXBoolColumnHeader("Conclusion", 80);
		boolcol.Editable = true;
		boolcol.TrueImage = Image.FromFile("true.png");
		boolcol.FalseImage = Image.FromFile("false.png");
		lstv.Columns.Add(boolcol);
		lstv.BeginUpdate();
		for (int i = 0; i < 100; i++) {
			//movie
			EXListViewItem item = new EXListViewItem(i.ToString());
			EXControlListViewSubItem cs = new EXControlListViewSubItem();
			ProgressBar b = new ProgressBar();
			b.Tag = item;
			b.Minimum = 0;
			b.Maximum = 1000;
			b.Step = 1;
			item.SubItems.Add(cs);
			lstv.AddControlToSubItem(b, cs);
			//genre
			item.SubItems.Add(new EXMultipleImagesListViewSubItem(new ArrayList(new object[] {imglst_genre.Images[1], imglst_genre.Images[2]}), "Romantic comedy"));
			//rate
			item.SubItems.Add(new EXMultipleImagesListViewSubItem(new ArrayList(new object[] {imglst_rate.Images[0]}), "1"));
			//cancel and resume
			EXControlListViewSubItem cs1 = new EXControlListViewSubItem();
			LinkLabel llbl = new LinkLabel();
			llbl.Text = "Start";
			llbl.Tag = cs;
			llbl.LinkClicked += new LinkLabelLinkClickedEventHandler(llbl_LinkClicked);
			item.SubItems.Add(cs1);
			lstv.AddControlToSubItem(llbl, cs1);
			//conclusion
			item.SubItems.Add(new EXBoolListViewSubItem(true));
			lstv.Items.Add(item);
		}
		lstv.EndUpdate();
		//statusstrip1
		statusstrip1.Items.AddRange(new ToolStripItem[] {toolstripstatuslabel1});
		//btn
		btn.Location = new Point(10, 450);
		btn.Text = "Remove Control";
		btn.AutoSize = true;
		btn.Click += new EventHandler(btn_Click);
		//btn2
		btn2.Location = new Point(btn.Right + 20, 450);
		btn2.Text = "Remove Image";
		btn2.AutoSize = true;
		btn2.Click += new EventHandler(btn2_Click);
		//this
		this.ClientSize = new Size(520, 510);
		this.Controls.Add(statusstrip1);
		Label lbl = new Label();
		lbl.Text = "Doubleclick on the subitems to edit...";
		lbl.Bounds = new Rectangle(10, 10, 480, 20);
		this.Controls.Add(lbl);
		this.Controls.Add(lstv);
		this.Controls.Add(btn);
		this.Controls.Add(btn2);
	}