KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a C# WinForms project that's very wizard like in its functionality. The individual steps live on a class called StepPanel, which inherits from the Panel control, within the form and those panels are organized in an array. What I've run into is that when UpdateUI() is called and walks the array, adjusts the wizards step title text for the current step, it makes sure that all of the inactive steps are hidden, and ensures that the active step is visible, in the right spot, and is the right size. Here's the code: private void UpdateUI() { // If the StepIndex equals the array length, that's 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 everything is said and done, Steps[StepIndex].Visible == false. I'm still perplexed by this behavior because I was working less than 30 minutes ago.
Tags (comma-separated)
Save Edits
Cancel