void ResultGrid_MoveToNext(object sender, EventArgs e) { ResultTextBox t = (ResultTextBox)sender; if (t.Row == Data.NumberOfDrivers - 1) { Confirm.Focus(); } else { DataBoxes[t.Row + 1, t.Column].Focus(); } }
void ResultGrid_FinishingStateChanged(object sender, FinishingState e) { if (DisplayType == ResultDisplayType.ByPosition) { ResultTextBox textBox = (ResultTextBox)sender; int round = textBox.Column; int changedRow = textBox.Row; for (int row = changedRow + 1; row < Data.NumberOfDrivers; row++) { DataBoxes[row, round].SetFinishingState(e); } } }
void InitialiseControls() { InitialiseToolStrip(); int rowSpacing = 26; int columnSpacing = 40; DataBoxes = new ResultTextBox[Data.NumberOfDrivers, Data.NumberOfTracks]; Rounds = new IndexedLabel[Data.NumberOfTracks]; RowLabels = new Label[Data.NumberOfDrivers]; int topPosition = 50; int leftPosition = 40; int tabIndex = 0; for (int racePosition = 0; racePosition < Data.NumberOfDrivers; racePosition++) { RowLabels[racePosition] = new Label { Left = 10, Width = 30, Top = topPosition, }; leftPosition = 40; tabIndex = racePosition; for (int roundIndex = 0; roundIndex < Data.NumberOfTracks; roundIndex++) { if (racePosition == 0) { Rounds[roundIndex] = new IndexedLabel(roundIndex) { Left = leftPosition, Top = 30, Width = columnSpacing }; Rounds[roundIndex].ResetColumn += ResultGrid_ResetColumn; } DataBoxes[racePosition, roundIndex] = new ResultTextBox(racePosition, roundIndex) { Width = columnSpacing - 6, Height = rowSpacing - 8, Left = leftPosition, Top = topPosition, TabIndex = tabIndex }; DataBoxes[racePosition, roundIndex].FinishingStateChanged += ResultGrid_FinishingStateChanged; DataBoxes[racePosition, roundIndex].MoveToNext += ResultGrid_MoveToNext; tabIndex += Data.NumberOfDrivers; leftPosition += columnSpacing; } topPosition += rowSpacing; } Confirm = new Button { FlatStyle = global::MyFlowLayout.Properties.Settings.Default.FlatStyle, Text = "Confirm", Width = 100, Height = 25, Left = this.Width - 220, Top = this.Height - 40 }; Confirm.Click += Confirm_Click; Reject = new Button { FlatStyle = global::MyFlowLayout.Properties.Settings.Default.FlatStyle, Text = "Reject", Width = 100, Height = 25, Left = this.Width - 110, Top = this.Height - 40 }; Reject.Click += Reject_Click; }