Ejemplo n.º 1
0
 /// <summary>
 /// Ceate an exact clone of this column
 /// </summary>
 /// <returns>An exact clone of this column</returns>
 public ManagedListViewColumn Clone()
 {
     ManagedListViewColumn newItem = new ManagedListViewColumn();
     newItem.HeaderText = this.HeaderText;
     newItem.HeaderTextColor = this.HeaderTextColor;
     newItem.ID = this.ID;
     newItem.SortMode = this.SortMode;
     newItem.Width = this.Width;
     return newItem;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Ceate an exact clone of this column
        /// </summary>
        /// <returns>An exact clone of this column</returns>
        public ManagedListViewColumn Clone()
        {
            ManagedListViewColumn newItem = new ManagedListViewColumn();

            newItem.HeaderText      = this.HeaderText;
            newItem.HeaderTextColor = this.HeaderTextColor;
            newItem.ID       = this.ID;
            newItem.SortMode = this.SortMode;
            newItem.Width    = this.Width;
            return(newItem);
        }
Ejemplo n.º 3
0
        // For debug purpose.
        private void toolStripButton6_Click(object sender, EventArgs e)
        {
            FormDetectSelection frm = new FormDetectSelection();
            if (frm.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                // Get the dataset of GAMES table
                DataSet ds = MyNesDB.GetDataSet(frm.MODE.ToString());

                if (ds == null) return;

                // Set columns
                if (ds.Tables[0].Rows.Count > 0)
                {
                    managedListView1.Items.Clear();
                    managedListView1.Columns.Clear();
                    for (int i = 0; i < ds.Tables[0].Columns.Count; i++)
                    {
                        ManagedListViewColumn col = new ManagedListViewColumn();
                        col.HeaderText = col.ID = ds.Tables[0].Columns[i].ToString();
                        managedListView1.Columns.Add(col);
                    }

                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        // Reached here means we can add the item
                        ManagedListViewItem item = new ManagedListViewItem();
                        // Put the id in the tag
                        item.Tag = ds.Tables[0].Rows[i]["Id"].ToString();
                        // Add subitems depending on columns
                        foreach (ManagedListViewColumn col in managedListView1.Columns)
                        {
                            ManagedListViewSubItem sub = new ManagedListViewSubItem();
                            sub.ColumnID = col.ID;
                            sub.Text = ds.Tables[0].Rows[i][col.ID].ToString();
                            item.SubItems.Add(sub);
                        }
                        managedListView1.Items.Add(item);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void contextMenuStrip_list_columns_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            // Change visibility
            ((ToolStripMenuItem)e.ClickedItem).Checked = !((ToolStripMenuItem)e.ClickedItem).Checked;
            // Update database
            MyNesDB.UpdateColumn(e.ClickedItem.Text, ((ToolStripMenuItem)e.ClickedItem).Checked);
            // Update managed list
            if (!((ToolStripMenuItem)e.ClickedItem).Checked)
            {
                for (int i = 0; i < managedListView1.Columns.Count; i++)
                {
                    if (managedListView1.Columns[i].HeaderText == e.ClickedItem.Text)
                    {
                        managedListView1.Columns.RemoveAt(i);

                        break;
                    }
                }
            }
            else
            {
                MyNesDBColumn c = MyNesDB.GetColumn(e.ClickedItem.Text);
                int index = MyNesDB.GetColumnIndex(e.ClickedItem.Text);
                // Add it !
                ManagedListViewColumn col = new ManagedListViewColumn();
                col.HeaderText = e.ClickedItem.Text;
                col.ID = e.ClickedItem.Text;
                col.Width = c.Width;
                managedListView1.Columns.Insert(index, col);
            }
        }
Ejemplo n.º 5
0
 private void RefreshColumns()
 {
     managedListView1.Columns.Clear();
     contextMenuStrip_list_columns.Items.Clear();
     MyNesDBColumn[] columns = MyNesDB.GetColumns();
     foreach (MyNesDBColumn k in columns)
     {
         if (k.Visible)
         {
             ManagedListViewColumn col = new ManagedListViewColumn();
             col.HeaderText = Program.ResourceManager.GetString(k.Name);
             col.ID = k.Name;
             col.Width = k.Width;
             managedListView1.Columns.Add(col);
         }
         ToolStripMenuItem it = new ToolStripMenuItem();
         it.Text = k.Name;
         it.Checked = k.Visible;
         contextMenuStrip_list_columns.Items.Add(it);
     }
 }