Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a2ae28d

Browse files
committed
refactor: resize MainForm when no Profile
1 parent 30854de commit a2ae28d

File tree

3 files changed

+64
-39
lines changed

3 files changed

+64
-39
lines changed

Netch/Forms/MainForm.Designer.cs

Lines changed: 63 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Netch/Forms/MainForm.Profile.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,8 @@ public partial class Dummy
1515

1616
partial class MainForm
1717
{
18-
/// init at <see cref="MainForm_Load"/>
19-
private int _sizeHeight;
20-
21-
private int _profileConfigurationHeight;
22-
private int _profileGroupboxHeight;
2318
private int _configurationGroupBoxHeight;
19+
private int _profileConfigurationHeight;
2420

2521
private void InitProfile()
2622
{
@@ -41,7 +37,6 @@ private void InitProfile()
4137
ProfileGroupBox.Visible = false;
4238

4339
ConfigurationGroupBox.Size = new Size(ConfigurationGroupBox.Size.Width, _configurationGroupBoxHeight - _profileConfigurationHeight);
44-
Size = new Size(Size.Width, _sizeHeight - (_profileConfigurationHeight + _profileGroupboxHeight));
4540
}
4641
else
4742
{
@@ -75,11 +70,9 @@ private void InitProfile()
7570
ProfileTable.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 1));
7671
}
7772

78-
if (Size.Height == _sizeHeight) return;
7973
configLayoutPanel.RowStyles[2].SizeType = SizeType.AutoSize;
8074
ProfileGroupBox.Visible = true;
8175
ConfigurationGroupBox.Size = new Size(ConfigurationGroupBox.Size.Width, _configurationGroupBoxHeight);
82-
Size = new Size(Size.Width, _sizeHeight);
8376
}
8477
}
8578

Netch/Forms/MainForm.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,8 @@ private void MainForm_Load(object sender, EventArgs e)
6464
// 隐藏 NatTypeStatusLabel
6565
NatTypeStatusText();
6666

67-
_sizeHeight = Size.Height;
6867
_configurationGroupBoxHeight = ConfigurationGroupBox.Height;
6968
_profileConfigurationHeight = ConfigurationGroupBox.Controls[0].Height / 3; // 因为 AutoSize, 所以得到的是Controls的总高度
70-
_profileGroupboxHeight = ProfileGroupBox.Height;
7169
// 加载快速配置
7270
InitProfile();
7371

0 commit comments

Comments
 (0)