private void ClickAddLine(object sender, EventArgs e) { Education_MovementStep newLine = new Education_MovementStep(); //CurrentMovement.Education_MovementStep.Add(newLine); GeneratePanelStep(newLine, CurrentMovement.Education_MovementStep.Count + 1); }
private void GeneratePanelStep(Education_MovementStep movementStep, int index) { Label newLabelNum = new Label(); newLabelNum.Paint += new PaintEventHandler(this.newLabelNumPaint); newLabelNum.Name = "newLabelNum_" + index; newLabelNum.Text = index.ToString(); newLabelNum.Size = lblNum.Size; int yLAbelNumAxisCalculated = this.lblNum.Location.Y + (this.lblNum.Size.Height - 5); int yCalculatedLAbel = this.lblNum.Location.Y + (this.lblNum.Size.Height); newLabelNum.Location = new Point(this.lblNum.Location.X, yLAbelNumAxisCalculated); newLabelNum.BackColor = Color.LightSkyBlue; //newlblFormationName.ForeColor = Color.FromArgb(0, 115, 204); newLabelNum.Font = lblNum.Font; TextBox newTbWho = new TextBox(); newTbWho.Paint += new PaintEventHandler(this.tbWhoPaint); newTbWho.TextChanged += new EventHandler(this.TextChanged); newTbWho.Name = "tbWhoStep_" + index; newTbWho.Text = movementStep.MovementStep_Who; newTbWho.Size = tbWhoStep.Size; int ynewTbWhoAxisCalculated = this.tbWhoStep.Location.Y + (this.tbWhoStep.Size.Height - 5); newTbWho.Location = new Point(this.tbWhoStep.Location.X, ynewTbWhoAxisCalculated); newTbWho.BackColor = Color.White; //newlblFormationName.ForeColor = Color.FromArgb(0, 115, 204); newTbWho.Font = tbWhoStep.Font; TextBox newtbSupport = new TextBox(); newtbSupport.Paint += new PaintEventHandler(this.newtbSupportPaint); newtbSupport.TextChanged += new EventHandler(this.TextChanged); newtbSupport.Name = "tbSupport_" + index; newtbSupport.Text = movementStep.MovementStep_Support; newtbSupport.Size = tbSupport.Size; int yLAbelAxisCalculated = (this.tbSupport.Location.Y - 30) + (this.tbSupport.Size.Height - 15); newtbSupport.Location = new Point(this.tbSupport.Location.X, yLAbelAxisCalculated); newtbSupport.BackColor = Color.White; //newlblFormationName.ForeColor = Color.FromArgb(0, 115, 204); newtbSupport.Multiline = true; newtbSupport.ScrollBars = ScrollBars.Both; newtbSupport.Font = tbSupport.Font; TextBox newtbAction = new TextBox(); newtbAction.Paint += new PaintEventHandler(this.tbActionPaint); newtbAction.TextChanged += new EventHandler(this.TextChanged); newtbAction.Name = "tbAction_" + index; newtbAction.Text = movementStep.MovementStep_IntituleAction; newtbAction.Size = tbSupport.Size; int ynewtbActionAxisCalculated = (this.tbAction.Location.Y - 30) + (this.tbAction.Size.Height - 15); newtbAction.Location = new Point(this.tbAction.Location.X, ynewtbActionAxisCalculated); newtbAction.BackColor = Color.White; newtbAction.Multiline = true; newtbAction.ScrollBars = ScrollBars.Both; //newlblFormationName.ForeColor = Color.FromArgb(0, 115, 204); newtbAction.Font = tbSupport.Font; // Pic Save line PictureBox newPicSave = new PictureBox(); newPicSave.Paint += new PaintEventHandler(this.PaintSave); newPicSave.Click += new EventHandler(this.pictureBox1_Click); newPicSave.Name = "newPicSave_" + index; newPicSave.Tag = movementStep.MovementStep_Id; newPicSave.Enabled = false; ToolTip tt = new ToolTip(); tt.SetToolTip(newPicSave, "Afficher les informations d'équivalence"); newPicSave.Visible = true; newPicSave.Image = Module_Education.Properties.Resources.outline_save_black_24dp1; newPicSave.SizeMode = PictureBoxSizeMode.Zoom; newPicSave.Size = picSave.Size; int yTbAxisCalculated = (this.picSave.Location.Y - 15) + this.picSave.Size.Height; newPicSave.Location = new Point(this.picSave.Location.X, yTbAxisCalculated); // Pic AddLine PictureBox newPicAddLine = new PictureBox(); newPicAddLine.Paint += new PaintEventHandler(this.PaintAddLine); newPicAddLine.Click += new EventHandler(this.ClickAddLine); newPicAddLine.Name = "newPicAddLine_" + index; ToolTip ttAddLine = new ToolTip(); tt.SetToolTip(newPicAddLine, "Ajouter une étape de la check-list"); newPicAddLine.Visible = true; newPicAddLine.Image = Module_Education.Properties.Resources.add_512; newPicAddLine.SizeMode = PictureBoxSizeMode.Zoom; newPicAddLine.Size = picAddStep.Size; int picAddStepAxisCalculated = (this.picAddStep.Location.Y - 15) + this.picAddStep.Size.Height; newPicAddLine.Location = new Point(this.picAddStep.Location.X, yTbAxisCalculated); Panel newPanel = new Panel(); newPanel.Paint += new PaintEventHandler(this.panel_Paint); if (index % 2 == 0) { newPanel.BackColor = Color.LightSkyBlue; } else { newPanel.BackColor = Color.LightSkyBlue; } newPanel.Size = this.panelStepItem.Size; newPanel.Name = "panelStepItem_" + index; int yAxisCalculated = (this.panelStepItem.Location.Y - 45) + (this.panelStepItem.Size.Height * index); newPanel.Location = new Point(this.panelStepItem.Location.X, yAxisCalculated); newPanel.Controls.Add(newLabelNum); newPanel.Controls.Add(newTbWho); newPanel.Controls.Add(newtbSupport); newPanel.Controls.Add(newtbAction); newPanel.Controls.Add(newPicSave); newPanel.Controls.Add(newPicAddLine); listPanelSteps.Add(newPanel); this.tabEditSteps.Controls.Add(newPanel); }