I have a C # WinForms project that is very magical, as in its functionality. Separate steps are performed in a class called StepPanel, which is inherited from the Panel control, inside the form, and these panels are organized into an array.
What I came across is that when UpdateUI () is called and moves through the array, it adjusts the title text of the wizard step for the current step, it ensures that all inactive steps are hidden, and ensures that the active step is displayed in the right place and has right size.
Here is the code:
private void UpdateUI() { // If the StepIndex equals the array length, that our cue // to exit. if (StepIndex == Steps.Length) { Application.Exit(); return; } for (var xx = 0; xx < Steps.Length; xx++) { if (xx == StepIndex) { if (!String.IsNullOrEmpty(Steps[xx].Title)) { LabelStepTitle.ForeColor = SystemColors.ControlText; LabelStepTitle.Text = Steps[xx].Title; } else { LabelStepTitle.ForeColor = Color.Red; LabelStepTitle.Text = Resources.UiWarning_StepTitleNotSet; } } else { Steps[xx].Visible = false; } } Steps[StepIndex].Top = 50; Steps[StepIndex].Left = 168; Steps[StepIndex].Width = 414; Steps[StepIndex].Height = 281; Steps[StepIndex].Visible = true; SetNavigationButtonState(true); }
When all is said and done, Steps [StepIndex] .Visible == false.
I am still perplexed by this behavior because I worked less than 30 minutes ago.
amber source share