简体   繁体   English

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

[英]How can i manipulate the Font Properties in c# on a run time

I really am new on this trying to manipulate the font property of a text or chart title in c# windows form 我真的很陌生,试图在C#Windows窗体中操纵文本或图表标题的font属性

so far i tried this ones: 到目前为止,我尝试了这些:

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.

i got Hands up on trying to set it's text to bold in windows form i've done it but only at a web apps which pretty much simplier Title / Or some Text 我开始尝试将它的文本设置为Windows窗体中的粗体,但只在Web应用程序上使用了,它的标题/或某些文本要简单得多

how do i set it's propert title font to change the text to bold instead of normal fontstyle? 我如何设置它的专有标题字体将文本更改为粗体而不是普通字体?

Try this: 尝试这个:

   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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM