From 6aa004da7fc94da94bf4cd4591529f59749cec28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Gross?= <loic.gross@unistra.fr> Date: Thu, 2 Apr 2020 10:11:04 +0200 Subject: [PATCH] InterfaceInfoCompletEleve ajout tableau des notes --- .../InterfaceInfoCompletEleve.Designer.cs | 23 ++--------- .../InterfaceInfoCompletEleve.cs | 39 ++++++++++++------- .../psychorientation/ListeEleve.cs | 14 +++---- 3 files changed, 36 insertions(+), 40 deletions(-) diff --git a/psychorientation/psychorientation/InterfaceInfoCompletEleve.Designer.cs b/psychorientation/psychorientation/InterfaceInfoCompletEleve.Designer.cs index 5ee83c8..c8b18aa 100755 --- a/psychorientation/psychorientation/InterfaceInfoCompletEleve.Designer.cs +++ b/psychorientation/psychorientation/InterfaceInfoCompletEleve.Designer.cs @@ -41,11 +41,9 @@ this.lblMoyenneNote = new System.Windows.Forms.Label(); this.pcbEleve = new System.Windows.Forms.PictureBox(); this.pnlNote = new System.Windows.Forms.Panel(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.panel1.SuspendLayout(); this.panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pcbEleve)).BeginInit(); - this.pnlNote.SuspendLayout(); this.SuspendLayout(); // // lblNomEleve @@ -163,25 +161,12 @@ // // pnlNote // - this.pnlNote.Controls.Add(this.tableLayoutPanel1); - this.pnlNote.Location = new System.Drawing.Point(98, 243); + this.pnlNote.AutoScroll = true; + this.pnlNote.Location = new System.Drawing.Point(85, 243); this.pnlNote.Name = "pnlNote"; - this.pnlNote.Size = new System.Drawing.Size(391, 134); + this.pnlNote.Size = new System.Drawing.Size(448, 134); this.pnlNote.TabIndex = 16; // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.ColumnCount = 3; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 119F)); - this.tableLayoutPanel1.Location = new System.Drawing.Point(16, 19); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 1; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(355, 50); - this.tableLayoutPanel1.TabIndex = 0; - // // InterfaceInfoCompletEleve // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -204,7 +189,6 @@ this.panel1.ResumeLayout(false); this.panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.pcbEleve)).EndInit(); - this.pnlNote.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -225,6 +209,5 @@ private System.Windows.Forms.Label lblMoyenneNote; private System.Windows.Forms.PictureBox pcbEleve; private System.Windows.Forms.Panel pnlNote; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; } } \ No newline at end of file diff --git a/psychorientation/psychorientation/InterfaceInfoCompletEleve.cs b/psychorientation/psychorientation/InterfaceInfoCompletEleve.cs index b06bfe8..39d4c8b 100755 --- a/psychorientation/psychorientation/InterfaceInfoCompletEleve.cs +++ b/psychorientation/psychorientation/InterfaceInfoCompletEleve.cs @@ -65,6 +65,7 @@ namespace psychorientation private void InitNote() { + int largeurLigne = 25; List<Note> listNote = this.eleve.GetlisteNotes(); TableLayoutPanel tlp = new TableLayoutPanel(); tlp.ColumnCount = 4; @@ -73,23 +74,35 @@ namespace psychorientation tlp.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); tlp.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); tlp.RowCount = 1 + listNote.Count; - for(int i=0; i<tlp.RowCount; i++) + + // Initialise la première ligne d'en-tête + tlp.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); + tlp.Controls.Add(CreerLabel("Nom :"), 0, 0); + tlp.Controls.Add(CreerLabel("Note :"), 1, 0); + tlp.Controls.Add(CreerLabel("Compétence :"), 2, 0); + tlp.Controls.Add(CreerLabel("Effort :"), 3, 0); + + // Rajoute les lignes supplémentaires + for (int i=1; i<tlp.RowCount; i++) { - tlp.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F)); + tlp.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); + Note note = listNote[i - 1]; + tlp.Controls.Add(CreerLabel(note.GetNom()), 0, i); + tlp.Controls.Add(CreerLabel(note.GetNote().ToString()), 1, i); + tlp.Controls.Add(CreerLabel(note.GetCompetence().ToString()), 2, i); + tlp.Controls.Add(CreerLabel(note.GetEffort().ToString()), 3, i); } + + tlp.Size = new System.Drawing.Size(413, largeurLigne* tlp.RowCount); + tlp.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single; pnlNote.Controls.Add(tlp); + } - /*this.tableLayoutPanel1.ColumnCount = 4; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); - this.tableLayoutPanel1.Location = new System.Drawing.Point(16, 19); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 1; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(413, 50); - this.tableLayoutPanel1.TabIndex = 0;*/ + private Label CreerLabel(string contenu) + { + Label lbl = new Label(); + lbl.Text = contenu; + return lbl; } diff --git a/psychorientation/psychorientation/ListeEleve.cs b/psychorientation/psychorientation/ListeEleve.cs index 9b8cea5..aedca0a 100755 --- a/psychorientation/psychorientation/ListeEleve.cs +++ b/psychorientation/psychorientation/ListeEleve.cs @@ -24,13 +24,13 @@ namespace psychorientation Libelle lib = new Libelle(); // TEST - Eleve e1 = new Eleve(4); - Eleve e2 = new Eleve(5); - e1.AjouterNote("une"); - e1.AjouterNote("deux"); - e1.AjouterNote("trois"); - gestEleve.AjouterEleve(e1); - gestEleve.AjouterEleve(e2); + //Eleve e1 = new Eleve(4); + //Eleve e2 = new Eleve(5); + //e1.AjouterNote("une"); + //e1.AjouterNote("deux"); + //e1.AjouterNote("trois"); + //gestEleve.AjouterEleve(e1); + //gestEleve.AjouterEleve(e2); List<Eleve> listEleve = gestEleve.GetListeEleves(); int y = 0; -- GitLab