public void SetColorMarker() { //Always display the button in the scroll view this.panelButtons.ScrollControlIntoView(markerButtons[buttonCounter]); var steps = this.mediaList; //Foreach steps for (var j = 0; j < steps.Count; j++) { MarkerButton markerButton = markerButtons[j]; if (markerButton != null) { if (buttonCounter == j) { markerButton.BackColor = System.Drawing.ColorTranslator.FromHtml("#84ce2c"); /** * Loads next media list */ this.LoadMediaListByIndex(buttonCounter); } else { markerButton.BackColor = System.Drawing.SystemColors.Control; } } } }
public void ChangeButtonCounter(object sender, System.EventArgs e) { if (sender is MarkerButton) { MarkerButton markerButton = (MarkerButton)sender; buttonCounter = markerButton.getStepIndex(); SetColorMarker(); } }
/// <summary> /// Initialize all the labels corresponding to the steps and the buttons /// </summary> public void InitializeActionComponents() { this.SuspendLayout(); //Clear the labels inside the panel buttons panelButtons.Controls.Clear(); //Clears the button list markerButtons.Clear(); var margin = 10; var panelWidth = panelButtons.Width - 16; var steps = this.mediaList; //Foreach steps for (var j = 0; j < steps.Count; j++) { //Creating the markerButton corresponding to this button step var markerButton = new MarkerButton(); markerButton.Name = "lblButton" + j; markerButton.Location = new System.Drawing.Point(margin, margin + (j * 40)); markerButton.Size = new System.Drawing.Size(panelWidth - (margin * 2), 30); markerButton.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; markerButton.Text = ""; //On click, focus the buttons panel (to allow mouse scroll) markerButton.Click += new System.EventHandler(panelButtons_Click); //On click, change the internal index markerButton.Click += new System.EventHandler(ChangeButtonCounter); //On double click, execute all actions of the marker button markerButton.DoubleClick += new System.EventHandler(ExecuteMarkerButton); markerButton.setStepIndex(j); var actions = steps[j]; //Write down all the actions for this button/counter for (var k = 0; k < actions.Length; k++) { markerButton.Text += actions[k].print() + "\n"; } panelButtons.Controls.Add(markerButton); //Add the button to the list of buttons markerButtons.Add(j, markerButton); } this.ResumeLayout(false); }
/// <summary> /// Initialize all the labels corresponding to the steps and the buttons /// </summary> public void InitializeActionComponents() { this.SuspendLayout(); //Clear the labels inside the panel buttons panelButtons.Controls.Clear(); //Clears the button list markerButtons.Clear(); var margin = 10; var panelWidth = panelButtons.Width - 16; var steps = this.mediaList; //Foreach steps for (var j = 0; j < steps.Count; j++) { //Creating the markerButton corresponding to this button step var markerButton = new MarkerButton(); markerButton.Name = "lblButton" + j; markerButton.Location = new System.Drawing.Point(margin, margin + (j * 40)); markerButton.Size = new System.Drawing.Size(panelWidth - (margin * 2), 30); markerButton.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; markerButton.Text = ""; //On click, focus the buttons panel (to allow mouse scroll) markerButton.Click += new System.EventHandler(panelButtons_Click); //On click, change the internal index markerButton.Click += new System.EventHandler(ChangeButtonCounter); //On double click, execute all actions of the marker button markerButton.DoubleClick += new System.EventHandler(ExecuteMarkerButton); markerButton.setStepIndex(j); var actions = steps[j]; //Write down all the actions for this button/counter for (var k = 0; k < actions.Length; k++) { markerButton.Text += actions[k].print() + "\n"; } panelButtons.Controls.Add(markerButton); //Add the button to the list of buttons markerButtons.Add(j, markerButton); } this.ResumeLayout(false); }