Skip to content

Commit 171fc18

Browse files
committed
Make Performance dialog centered in relation to parent window and allow user to change font
1 parent fad059a commit 171fc18

21 files changed

+70
-21
lines changed

SimpleTaskManager/AboutForm.Designer.cs

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

SimpleTaskManager/App.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
<setting name="EnableColorChanging" serializeAs="String">
1414
<value>True</value>
1515
</setting>
16+
<setting name="DefaultFont" serializeAs="String">
17+
<value>Segoe UI, 8.25pt</value>
18+
</setting>
1619
</SimpleTaskManager.Properties.Settings>
1720
</userSettings>
1821
</configuration>

SimpleTaskManager/PerfForm.Designer.cs

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

SimpleTaskManager/Properties/Settings.Designer.cs

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

SimpleTaskManager/Properties/Settings.settings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@
55
<Setting Name="EnableColorChanging" Type="System.Boolean" Scope="User">
66
<Value Profile="(Default)">True</Value>
77
</Setting>
8+
<Setting Name="DefaultFont" Type="System.Drawing.Font" Scope="User">
9+
<Value Profile="(Default)">Segoe UI, 8.25pt</Value>
10+
</Setting>
811
</Settings>
912
</SettingsFile>

SimpleTaskManager/TaskManagerForm.Designer.cs

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SimpleTaskManager/TaskManagerForm.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public TaskManagerForm()
1313
InitializeComponent();
1414
GetProcess();
1515
enableColorChangingToolStripMenuItem.Checked = Properties.Settings.Default.EnableColorChanging;
16+
listView.Font = Properties.Settings.Default.DefaultFont;
1617
}
1718

1819
Process[] processes;
@@ -32,7 +33,8 @@ void GetProcess() // liệt kê các tiến trình đang thực hiện tại th
3233
newItem.SubItems.Add(new ListViewItem.ListViewSubItem() { Text = p.PrivateMemorySize64.ToString() });
3334
listView.Items.Add(newItem);
3435
}
35-
if (Properties.Settings.Default.EnableColorChanging == true)
36+
listView.Font = Properties.Settings.Default.DefaultFont;
37+
if (Properties.Settings.Default.EnableColorChanging)
3638
{
3739
changeColor();
3840
}
@@ -210,5 +212,19 @@ private void closeToolStripMenuItem_Click(object sender, EventArgs e)
210212
{
211213
this.Close();
212214
}
215+
216+
private void menuItem7_Click(object sender, EventArgs e)
217+
{
218+
using (FontDialog fd = new FontDialog())
219+
{
220+
fd.Font = Properties.Settings.Default.DefaultFont;
221+
if (fd.ShowDialog() == DialogResult.OK)
222+
{
223+
Properties.Settings.Default.DefaultFont = fd.Font;
224+
Properties.Settings.Default.Save();
225+
listView.Font = Properties.Settings.Default.DefaultFont;
226+
}
227+
}
228+
}
213229
}
214230
}
512 Bytes
Binary file not shown.

SimpleTaskManager/bin/Debug/Task Manager.exe.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
<setting name="EnableColorChanging" serializeAs="String">
1414
<value>True</value>
1515
</setting>
16+
<setting name="DefaultFont" serializeAs="String">
17+
<value>Segoe UI, 8.25pt</value>
18+
</setting>
1619
</SimpleTaskManager.Properties.Settings>
1720
</userSettings>
1821
</configuration>
2 KB
Binary file not shown.

0 commit comments

Comments
 (0)