Fix ever-widening Form1 when form size is restored.
This commit is contained in:
parent
a790c7535c
commit
68cfae1d58
@ -105,13 +105,14 @@ namespace LibationWinForms
|
|||||||
splitContainer1.Panel2Collapsed = false;
|
splitContainer1.Panel2Collapsed = false;
|
||||||
processBookQueue1.popoutBtn.Visible = true;
|
processBookQueue1.popoutBtn.Visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Configuration.Instance.SetNonString(splitContainer1.Panel2Collapsed, nameof(splitContainer1.Panel2Collapsed));
|
||||||
toggleQueueHideBtn.Text = splitContainer1.Panel2Collapsed ? "❰❰❰" : "❱❱❱";
|
toggleQueueHideBtn.Text = splitContainer1.Panel2Collapsed ? "❰❰❰" : "❱❱❱";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ToggleQueueHideBtn_Click(object sender, EventArgs e)
|
private void ToggleQueueHideBtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
SetQueueCollapseState(!splitContainer1.Panel2Collapsed);
|
SetQueueCollapseState(!splitContainer1.Panel2Collapsed);
|
||||||
Configuration.Instance.SetNonString(splitContainer1.Panel2Collapsed, nameof(splitContainer1.Panel2Collapsed));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProcessBookQueue1_PopOut(object sender, EventArgs e)
|
private void ProcessBookQueue1_PopOut(object sender, EventArgs e)
|
||||||
|
|||||||
@ -17,7 +17,7 @@ namespace LibationWinForms
|
|||||||
//Set this size before restoring form size and position
|
//Set this size before restoring form size and position
|
||||||
splitContainer1.Panel2MinSize = this.DpiScale(350);
|
splitContainer1.Panel2MinSize = this.DpiScale(350);
|
||||||
this.RestoreSizeAndLocation(Configuration.Instance);
|
this.RestoreSizeAndLocation(Configuration.Instance);
|
||||||
this.FormClosing += (_, _) => this.SaveSizeAndLocation(Configuration.Instance);
|
FormClosing += Form1_FormClosing;
|
||||||
|
|
||||||
// this looks like a perfect opportunity to refactor per below.
|
// this looks like a perfect opportunity to refactor per below.
|
||||||
// since this loses design-time tooling and internal access, for now I'm opting for partial classes
|
// since this loses design-time tooling and internal access, for now I'm opting for partial classes
|
||||||
@ -58,6 +58,14 @@ namespace LibationWinForms
|
|||||||
Shown += Form1_Shown;
|
Shown += Form1_Shown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
|
{
|
||||||
|
//Always close the queue before saving the form to prevent
|
||||||
|
//Form1 from getting excessively wide when it's restored.
|
||||||
|
SetQueueCollapseState(true);
|
||||||
|
this.SaveSizeAndLocation(Configuration.Instance);
|
||||||
|
}
|
||||||
|
|
||||||
private async void Form1_Shown(object sender, EventArgs e)
|
private async void Form1_Shown(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (Configuration.Instance.FirstLaunch)
|
if (Configuration.Instance.FirstLaunch)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user