diff --git a/CarteAccesLib/Chemin.cs b/CarteAccesLib/Chemin.cs index f084c5c..5f5a284 100644 --- a/CarteAccesLib/Chemin.cs +++ b/CarteAccesLib/Chemin.cs @@ -10,6 +10,8 @@ public static class Chemin public static string CheminEdtClassique { get; set; } = "./data/FichierEdtClasse"; public static string CheminFaceCarte { get; set; } = "./data/FichierCartesFace/"; + public static string CheminEdtPerso { get; set; } = ""; + public static string CheminEdt { get; set; } = ""; public static string setCheminImportationFaceCarte() diff --git a/CarteAccesLib/Edt.cs b/CarteAccesLib/Edt.cs index 1036915..dbe6365 100644 --- a/CarteAccesLib/Edt.cs +++ b/CarteAccesLib/Edt.cs @@ -26,23 +26,34 @@ public static void afficheEmploiDuTemps(ComboBox cbbClasse, PictureBox pbCarteAr } } - public static void ajouterEdtPerso(PictureBox pbCarteArriere) + public static void ajouterEdtPerso(PictureBox pbCarteArriere, Button btnSelect) { - // -- Parcours des fichiers... - var opf = new OpenFileDialog(); + try + { + // -- Parcours des fichiers... + var opf = new OpenFileDialog(); + + var opfPath = ""; - var opfPath = ""; + opf.InitialDirectory = "./data/ElevesEdt/"; + opf.Filter = "Images (*.png, *.jpg) | *.png; *.jpg"; + opf.FilterIndex = 1; + opf.RestoreDirectory = true; + Chemin.CheminEdtPerso = ""; - opf.InitialDirectory = "./data/ElevesEdt/"; - opf.Filter = "Images (*.png, *.jpg) | *.png; *.jpg"; - opf.FilterIndex = 1; - opf.RestoreDirectory = true; + if (opf.ShowDialog() == DialogResult.OK) + { + opfPath = opf.FileName; + // -- Ajout de l'image dans la picturebox, celle ci devient visible + pbCarteArriere.Image = new Bitmap(opfPath); + Chemin.CheminEdtPerso = opfPath; + btnSelect.Enabled = true; + } - if (opf.ShowDialog() == DialogResult.OK) + } + catch { - opfPath = opf.FileName; - // -- Ajout de l'image dans la picturebox, celle ci devient visible - pbCarteArriere.Image = new Bitmap(opfPath); + btnSelect.Enabled = true; } } diff --git a/CartesAcces/frmCarteParClasseNiveau.Designer.cs b/CartesAcces/frmCarteParClasseNiveau.Designer.cs index a2d8fb7..e7c9a6f 100644 --- a/CartesAcces/frmCarteParClasseNiveau.Designer.cs +++ b/CartesAcces/frmCarteParClasseNiveau.Designer.cs @@ -37,6 +37,7 @@ private void InitializeComponent() this.NbComptageEleveCS = new System.Windows.Forms.Label(); this.lblCount = new System.Windows.Forms.Label(); this.cbbImprClasse = new System.Windows.Forms.ComboBox(); + this.label3 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // label1 @@ -53,18 +54,18 @@ private void InitializeComponent() // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F); - this.label2.Location = new System.Drawing.Point(157, 258); + this.label2.Location = new System.Drawing.Point(158, 261); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(137, 16); + this.label2.Size = new System.Drawing.Size(126, 16); this.label2.TabIndex = 1; - this.label2.Text = "Imprimer une section :"; + this.label2.Text = "Imprimer par niveau"; // // cbbImprSection // this.cbbImprSection.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cbbImprSection.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F); this.cbbImprSection.FormattingEnabled = true; - this.cbbImprSection.Items.AddRange(new object[] {"6eme", "5eme", "4eme", "3eme"}); + this.cbbImprSection.Items.AddRange(new object[] { "6eme", "5eme", "4eme", "3eme" }); this.cbbImprSection.Location = new System.Drawing.Point(301, 258); this.cbbImprSection.MaximumSize = new System.Drawing.Size(180, 0); this.cbbImprSection.MinimumSize = new System.Drawing.Size(180, 0); @@ -111,7 +112,7 @@ private void InitializeComponent() // // lblCount // - this.lblCount.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (0))); + this.lblCount.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblCount.Location = new System.Drawing.Point(474, 329); this.lblCount.Name = "lblCount"; this.lblCount.Size = new System.Drawing.Size(47, 23); @@ -131,11 +132,21 @@ private void InitializeComponent() this.cbbImprClasse.TabIndex = 28; this.cbbImprClasse.SelectionChangeCommitted += new System.EventHandler(this.cbbImprClasse_SelectedIndexChanged); // + // label3 + // + this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label3.Location = new System.Drawing.Point(199, 227); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(49, 24); + this.label3.TabIndex = 29; + this.label3.Text = "OU"; + // // frmCarteParClasseNiveau // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1109, 749); + this.Controls.Add(this.label3); this.Controls.Add(this.cbbImprClasse); this.Controls.Add(this.lblCount); this.Controls.Add(this.NbComptageEleveCS); @@ -151,6 +162,8 @@ private void InitializeComponent() this.PerformLayout(); } + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label lblCount; #endregion diff --git a/CartesAcces/frmCarteProvisoire.cs b/CartesAcces/frmCarteProvisoire.cs index 51e0695..8d64ec9 100644 --- a/CartesAcces/frmCarteProvisoire.cs +++ b/CartesAcces/frmCarteProvisoire.cs @@ -64,6 +64,7 @@ private void btnReset_Click(object sender, EventArgs e) rdbUlis.Checked = false; rdbUPE2A.Checked = false; rdbRas.Checked = true; + btnSelect.Enabled = true; } catch { @@ -221,7 +222,16 @@ private void pbCarteArriere_MouseUp(object sender, MouseEventArgs e) Edition.RognageY = Math.Min(Edition.RognageY, e.Y); Cursor = Cursors.Default; var classe = cbbClasse.Text; - var pathEdt = "./data/FichierEdtClasse/" + classe + ".jpg"; + string pathEdt; + if (Chemin.CheminEdtPerso == "") + { + pathEdt = "./data/FichierEdtClasse/" + classe + ".jpg"; + } + else + { + pathEdt = Chemin.CheminEdtPerso; + } + Edition.SelectionClique = false; Edt.rognageEdt(pbCarteArriere, pathEdt); } @@ -229,7 +239,15 @@ private void pbCarteArriere_MouseUp(object sender, MouseEventArgs e) { Cursor = Cursors.Default; var classe = cbbClasse.Text; - var pathEdt = "./data/FichierEdtClasse/" + classe + ".jpg"; + string pathEdt; + if (Chemin.CheminEdtPerso == "") + { + pathEdt = "./data/FichierEdtClasse/" + classe + ".jpg"; + } + else + { + pathEdt = Chemin.CheminEdtPerso; + } Edition.SelectionClique = false; pbCarteArriere.Image = Image.FromFile(pathEdt); @@ -369,8 +387,15 @@ private void rdbRas_CheckedChanged(object sender, EventArgs e) private void btnEdtPerso_Click(object sender, EventArgs e) { - Edt.ajouterEdtPerso(pbCarteArriere); - groupBox2.Enabled = false; + try + { + Edt.ajouterEdtPerso(pbCarteArriere, btnSelect); + btnSelect.Enabled = true; + } + catch + { + btnSelect.Enabled = true; + } } private void label6_Click(object sender, EventArgs e)