@@ -42,6 +42,8 @@ public partial class Form1 : Form
4242 private bool DataGridView1_ValueChangedSema = false ;
4343 private bool gpSuccession_ValueChangedSema = false ;
4444
45+ private readonly int gpSuccession_Height ;
46+
4547 #region Form
4648
4749 public Form1 ( )
@@ -55,6 +57,9 @@ public Form1()
5557 gpSuccession_ValueChangedSema = false ;
5658 DataGridView1_ValueChangedSema = false ;
5759
60+ gpSuccession_Height = gpSuccession . Height ;
61+ ShowSuccessionMenu ( false ) ; // start collapsed
62+
5863 pi = DataGridView1 ; // for better capsulation
5964 om = new OutModule ( pi ) ;
6065 sc = new Shortcuts ( Handle ) ;
@@ -108,6 +113,7 @@ private void Form1_Resize(object sender, EventArgs e)
108113
109114 // succession group
110115 txtPredecessorTitle . Width = gpSuccession . Width - txtPredecessorTitle . Left - Pad_Frame ;
116+ btnSuccessionVisibility . Left = gpSuccession . Width - btnSuccessionVisibility . Width - Pad_Frame ;
111117 }
112118
113119 protected override void WndProc ( ref Message m )
@@ -589,11 +595,14 @@ private void BtnSuccessionProceed_Click(object sender, EventArgs e)
589595 int TotalPB = 0 ;
590596 GetCalculatedSums ( ref TotalHits , ref TotalHitsWay , ref TotalPB ) ;
591597 SetSuccession ( TotalHits , TotalHitsWay , TotalPB ) ;
598+ ShowSuccessionMenu ( true ) ;
592599 SuccessionChanged ( sender , e ) ;
593600
594601 MessageBox . Show ( "The progress of this profile was saved.\n You can select your next profile now!" , "Succession" , MessageBoxButtons . OK , MessageBoxIcon . Information ) ;
595602 }
596-
603+
604+ private void btnSuccessionVisibility_Click ( object sender , EventArgs e ) { ShowSuccessionMenu ( ) ; }
605+
597606 /// <summary>
598607 /// Interchange of two data rows
599608 /// </summary>
@@ -619,6 +628,31 @@ private bool PermuteSplit(int idx_from, int offset)
619628 return true ;
620629 }
621630
631+ /// <summary>
632+ /// Collapses or expands succession menu
633+ /// </summary>
634+ /// <param name="expand">TRUE = Expand, FALSE = Collapse, NULL = Toggle</param>
635+ private void ShowSuccessionMenu ( Nullable < bool > expand = null )
636+ {
637+ int diff = 0 ;
638+
639+ if ( ! expand . HasValue ) expand = gpSuccession . Height != gpSuccession_Height ; // Toggle
640+
641+ if ( expand . Value ) // Expand..
642+ {
643+ diff = gpSuccession_Height - gpSuccession . Height ;
644+ gpSuccession . Height = gpSuccession_Height ;
645+ btnSuccessionVisibility . BackgroundImage = Sources . Resources . icons8_double_up_20 ;
646+ }
647+ else // Collapse..
648+ {
649+ diff = btnSuccessionVisibility . Height - gpSuccession . Height ;
650+ gpSuccession . Height = btnSuccessionVisibility . Height ;
651+ btnSuccessionVisibility . BackgroundImage = Sources . Resources . icons8_double_down_20 ;
652+ }
653+ Height += diff ;
654+ }
655+
622656 private void SetSuccession ( int TotalHits , int TotalHitsWay , int TotalPB , string Title = null , bool ShowPredecessor = true )
623657 {
624658 gpSuccession_ValueChangedSema = true ;
0 commit comments