/// <summary> /// Enregistre la TBL /// </summary> /// <param name="filename">Nom du fichier</param> public void Save(string filename) { TBLStream tbl = new TBLStream(filename); TBLEntry entry = null; for (int i = ItemPanel.Controls.Count; i > 0; i--) { entry = (TBLEntry)ItemPanel.Controls[i - 1]; tbl.Add(new DTE(entry.Entry, entry.Value)); } tbl.Save(); }
public void LoadFile(string filename) { //Creation l'objet TBL TBLStream myTBL = new TBLStream(); //Charger la table if (myTBL.Load(filename)) { //Vide la liste //lvTable.Items.Clear(); this._filename = filename; //this._FileName = FileName; this.ItemPanel.SuspendLayout(); //remplir la list TBLEntry[] entry = new TBLEntry[myTBL.Length]; int j = 0; //for (int i=0; i< myTBL.Length; i++ ){ for (int i = myTBL.Length - 1; i > -1; i--) { entry[i] = new TBLEntry(); //Dock TOP pour un auto resize entry[i].Dock = DockStyle.Top; //Remplir le control entry[i].Entry = myTBL[j].Entry; entry[i].Value = myTBL[j].Value; entry[i].Type = myTBL[j].Type; //Creation du tag pour la recherche entry[i].Tag = "entry" + this.ItemPanel.Controls.Count; j++; } this.ItemPanel.Controls.AddRange(entry); this.ItemPanel.ResumeLayout(); AddItem("", ""); this.OnResize(EventArgs.Empty); } }
public void AddItem(string Entry, string Value) { TBLEntry entry = new TBLEntry(); //Dock TOP pour un auto resize entry.Dock = DockStyle.Top; //Remplir le control entry.Entry = Entry; entry.Value = Value; //Creation du tag pour la recherche entry.Tag = "entry" + this.ItemPanel.Controls.Count; //Ajoute les controls this.ItemPanel.Controls.Add(entry); //Ajoute a la fin de la liste entry.BringToFront(); }