Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I would make use of something similar to a FormSwitcher:</p> <pre><code>public class FormSwitcher { private List&lt;Func&lt;Form&gt;&gt; constructors; private int currentConstructor = 1; public FormSwitcher(Func&lt;Form&gt; firstForm) { constructors = new List&lt;Func&lt;Form&gt;&gt;(); AddForm(firstForm); } public void AddForm(Func&lt;Form&gt; constructor) { constructors.Add(constructor); } public Form GetNextForm() { if (constructors.Count &gt; 0 &amp;&amp; currentConstructor &gt;= constructors.Count) { currentConstructor = 0; } if (constructors.Count &gt; currentConstructor) { return constructors[currentConstructor++](); } return null; } } </code></pre> <p>Your main form should look like this:</p> <pre><code>public partial class MainForm : Form { public MainForm() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { new FirstForm().Show(); } } </code></pre> <p>The rotating forms could look like this:</p> <pre><code>public partial class FirstForm : Form { private FormSwitcher switcher; public FirstForm() { InitializeComponent(); switcher = new FormSwitcher(() =&gt; new FirstForm()); switcher.AddForm(() =&gt; new SecondForm(switcher)); switcher.AddForm(() =&gt; new ThirdForm(switcher)); } private void button1_Click(object sender, EventArgs e) { switcher.GetNextForm().Show(); Close(); } } public partial class SecondForm : Form { private FormSwitcher switcher; public SecondForm(FormSwitcher switcher) { InitializeComponent(); this.switcher = switcher; } private void button1_Click(object sender, EventArgs e) { switcher.GetNextForm().Show(); Close(); } } public partial class ThirdForm : Form { private FormSwitcher switcher; public ThirdForm(FormSwitcher switcher) { InitializeComponent(); this.switcher = switcher; } private void button1_Click(object sender, EventArgs e) { switcher.GetNextForm().Show(); Close(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload