在C#中怎样让每一行字体是随机产生的颜色啊,下面是字体代码
Graphicsg=this.CreateGraphics();LinearGradientBrushmyBrush=newLinearGradientBrush(Cli...
Graphics g = this.CreateGraphics();
LinearGradientBrush myBrush = new
LinearGradientBrush(ClientRectangle, Color.Red,
Color.Yellow,LinearGradientMode.Horizontal);
Font myFont = new Font("Times New Roman", 24);
FontFamily[] families = FontFamily.GetFamilies(e.Graphics);
Font font;
string familyString;
float spacing = 0f;
int top = families.Length > 10 ? 10 : families.Length;
for (int i = 0; i < top; i++)
{
font = new Font(families[i], 16, FontStyle.Bold);
familyString = "This is the " + families[i].Name + "family.";
e.Graphics.DrawString(familyString, font, Brushes.Azure, new PointF(0, spacing));
spacing += font.Height + 3; 展开
LinearGradientBrush myBrush = new
LinearGradientBrush(ClientRectangle, Color.Red,
Color.Yellow,LinearGradientMode.Horizontal);
Font myFont = new Font("Times New Roman", 24);
FontFamily[] families = FontFamily.GetFamilies(e.Graphics);
Font font;
string familyString;
float spacing = 0f;
int top = families.Length > 10 ? 10 : families.Length;
for (int i = 0; i < top; i++)
{
font = new Font(families[i], 16, FontStyle.Bold);
familyString = "This is the " + families[i].Name + "family.";
e.Graphics.DrawString(familyString, font, Brushes.Azure, new PointF(0, spacing));
spacing += font.Height + 3; 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询