C# 在C中使用字符串格式的制动线和粗体文本#
我想能够使刹车线和粗体名称,开始日期,结束日期,排班和信息 这是我的密码C# 在C中使用字符串格式的制动线和粗体文本#,c#,string.format,C#,String.format,我想能够使刹车线和粗体名称,开始日期,结束日期,排班和信息 这是我的密码 private void FillEventInfo(Event e) { txtBoxEventInfo.Text = String.Format( "Navn: {0} Startdate: {1} Enddate: {2} Rostersize: {3} Info: {4} ", e.Name, e.St
private void FillEventInfo(Event e)
{
txtBoxEventInfo.Text = String.Format(
"Navn: {0} Startdate: {1} Enddate: {2} Rostersize: {3} Info: {4} ",
e.Name,
e.StartDate,
e.EndDate,
e.RosterSize,
e.Description
);
}
如果你想格式化文本,你需要使用
RichTextBox
,而不是TextBox
(只支持纯文本)。如果你想格式化文本,你需要使用RichTextBox
,而不是TextBox
(只支持纯文本)。没有办法格式化不同装饰的单词。尝试使用具有不同字体设置的单独标签\文本框,如下所示:
private void FillEventInfo(Event e)
{
txtBoxEventInfo.Font = new Font(<someFontFamily>, 16);
txtBoxEventInfo.Text = String.Format("Navn: {0} Startdate: {1} Enddate:{2} Rostersize: {3} Info: {4} ", e.Name, e.StartDate, e.EndDate, e.RosterSize, e.Description);
txtBoxSomeOtherEventInfo.Font = new Font(<someOtherFontFamily>, 22);
txtBoxSomeOtherEventInfo.Text = "Some other text"
}
没有办法用不同的装饰来格式化单独的单词。尝试使用具有不同字体设置的单独标签\文本框,如下所示:
private void FillEventInfo(Event e)
{
txtBoxEventInfo.Font = new Font(<someFontFamily>, 16);
txtBoxEventInfo.Text = String.Format("Navn: {0} Startdate: {1} Enddate:{2} Rostersize: {3} Info: {4} ", e.Name, e.StartDate, e.EndDate, e.RosterSize, e.Description);
txtBoxSomeOtherEventInfo.Font = new Font(<someOtherFontFamily>, 22);
txtBoxSomeOtherEventInfo.Text = "Some other text"
}