标题:Font完成的意想不到的效果!
只看楼主
随风云
Rank: 1
等 级:新手上路
威 望:1
帖 子:263
专家分:0
注 册:2007-6-28
 问题点数:0 回复次数:1 
Font完成的意想不到的效果!

我在MSDN上看的,FONT类的用法:有段代码稍加改造就完成了一个意想不到的效果:
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
MPaint (e);
return;
}
private void MPaint(PaintEventArgs e)
{
float m = 3.0f;
// Create a Font object.
Font myFont = new Font("Arial", 16);
//Draw text to the screen with myFont.
e.Graphics.DrawString(
"This is the first line",
myFont,
Brushes.Yellow ,
new PointF(0, 0));
//Get the height of myFont.
float height = myFont.GetHeight(m);
//Draw text immediately below the first line of text.
e.Graphics.DrawString(
"This is the first line",
myFont,
Brushes.Red ,
new PointF(0, height));

}
效果如下图:


搜索更多相关主题的帖子: 效果 
2007-10-31 23:17



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-182425-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.112412 second(s), 9 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved