Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在运行时操作c中的字体属性_C#_.net_Windows_Winforms_Charts - Fatal编程技术网

C# 如何在运行时操作c中的字体属性

C# 如何在运行时操作c中的字体属性,c#,.net,windows,winforms,charts,C#,.net,Windows,Winforms,Charts,我真的是新手,尝试在c windows窗体中操作文本或图表标题的字体属性 到目前为止,我试过这个: Font font = new System.Drawing.Font(FontStyle.Bold) <-- it wouldn't do debugging Chart1.Title[0].Font = new Font(Chart1.Title[0].Font, Chart1.Title[0].Font.Style | FontStyle.Bold); <-- this go

我真的是新手,尝试在c windows窗体中操作文本或图表标题的字体属性

到目前为止,我试过这个:

Font font = new System.Drawing.Font(FontStyle.Bold) <-- it wouldn't do debugging

Chart1.Title[0].Font = new Font(Chart1.Title[0].Font, 
Chart1.Title[0].Font.Style | FontStyle.Bold); <-- this got pass to debugging by no effect

Chart1.Title[0].Font(FontStyle.Bold); <-- so is this one pass debugging but no effect.
我曾尝试在windows窗体中将其文本设置为粗体。我已经这样做了,但只是在一个web应用程序中,它的标题/或某些文本更加简单

如何设置其属性标题字体以将文本更改为粗体而不是普通字体样式?

尝试以下操作:

   Title title = Chart1.Titles.Add("Test");
   title.Font = new System.Drawing.Font("Arial", 16, FontStyle.Bold);
   title.ForeColor = System.Drawing.Color.FromArgb(0, 0, 205);

你说它不能调试是什么意思?你说我举手是什么意思?你的问题很不清楚。除了Jon所说的,尽量确保你编写的代码没有语法错误。我的意思是,你的代码的第2行和第3行不应该像现在这样编译。@Jon Skeet抱歉,先生,我的意思是它不能进行调试,我试过运行visual studion,但它已经有错误,所以当我试着运行它时它不会通过。如果它通过了调试,意味着代码不会运行错误,但对我试图显示的内容没有影响。@Jon Skeet,而且我举手了,这意味着我已经放弃了研究并做了一些事情,只是为了得到正确的结果。所以我问你们一个问题,若你们有错误,请说那个些错误是什么,永远。如果你有例外,也告诉我们。