Skip to content

Commit 842d70e

Browse files
committed
If we set the window size before Load event, CenterToScreen call is not necessary
1 parent 0a4a324 commit 842d70e

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

DeadLock/Forms/FrmMain.cs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ public FrmMain(string[] args)
6060
_languageManager.LoadLanguage(Properties.Settings.Default.Language);
6161
}
6262
LanguageSwitch();
63+
64+
nfiTray.Visible = Properties.Settings.Default.ShowNotifyIcon;
65+
if (Properties.Settings.Default.RememberFormSize)
66+
{
67+
Size = Properties.Settings.Default.FormSize;
68+
}
6369
}
6470
catch (Exception ex)
6571
{
@@ -248,19 +254,6 @@ private void LoadTheme()
248254
private void FrmMain_Load(object sender, EventArgs e)
249255
{
250256
versionStaticBarItem.Text += " " + Application.ProductVersion;
251-
try
252-
{
253-
nfiTray.Visible = Properties.Settings.Default.ShowNotifyIcon;
254-
if (Properties.Settings.Default.RememberFormSize)
255-
{
256-
Size = Properties.Settings.Default.FormSize;
257-
CenterToScreen();
258-
}
259-
}
260-
catch (Exception ex)
261-
{
262-
MessageBoxAdv.Show(ex.Message, "DeadLock", MessageBoxButtons.OK, MessageBoxIcon.Error);
263-
}
264257
}
265258

266259
private void aboutBarItem_Click(object sender, EventArgs e)

0 commit comments

Comments
 (0)