Reputation: 95
I'm trying to make bold text in richTextBox. Text I want to make bold is in a second row "Cpu usage" in code.
Can you edit this code to make it bold?
double cpuUsage = Math.Round(perfCpuCount.NextValue(), 2);
MonitorLog.AppendText(string.Format("Cpu usage: {0}%\r\n\n", cpuUsage));
Upvotes: 0
Views: 571
Reputation: 14153
Change the SelectionFont
to include the bold style, and write the text that should be bold, then switch it back to regular:
MonitorLog.SelectionFont = new Font(MonitorLog.Font, FontStyle.Bold);
MonitorLog.AppendText("CPU Usage:");
MonitorLog.SelectionFont = new Font(MonitorLog.Font, FontStyle.Regular);
MonitorLog.AppendText(string.Format(" {0}%\r\n\n", cpuUsage));
Upvotes: 3