日期:2014-05-19  浏览次数:20479 次

|M| 如何复制Font 在线
Font   font1   =   new   Font(.....);
如我定义了一个font1
然后我又要定义一个
font2
要求是这个font2和font1一样以外
还要font2为粗体   下划线

谢谢

------解决方案--------------------
font2=new Font(font1,font1.Style|font1.Bold);

------解决方案--------------------
Font font1 = new Font( "宋体 ", 9, FontStyle.Regular); Font font2 = new Font(font1, font1.Style | FontStyle.Underline | FontStyle.Bold); Bitmap bmp = new Bitmap(100, 100); Graphics g = Graphics.FromImage(bmp); SolidBrush sb = new SolidBrush(Color.Red); g.DrawString( "aaaa ", font1, sb,0,0); g.DrawString( "bbbbbbbb ", font2, sb, 0, 20); bmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);
------解决方案--------------------
Font font1 = new Font( "宋体 ", 9, FontStyle.Regular);

Font font2 = new Font(font1, font1.Style | FontStyle.Underline | FontStyle.Bold);


Bitmap bmp = new Bitmap(100, 100);
Graphics g = Graphics.FromImage(bmp);
SolidBrush sb = new SolidBrush(Color.Red);
g.DrawString( "aaaa ", font1, sb,0,0);
g.DrawString( "bbbbbbbb ", font2, sb, 0, 20);

bmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);
------解决方案--------------------
Font font1 = new Font( "宋体 ", 9, FontStyle.Regular);

Font font2 = new Font(font1, font1.Style | FontStyle.Underline | FontStyle.Bold);


------解决方案--------------------
我顶 顶顶顶
------解决方案--------------------
up
------解决方案--------------------
我倒, 不主这样嘛:
font f1 = new font(....);// 定义好的一个font
font f2 = f1;//这样就将f1 复制到f2啦
------解决方案--------------------
呵呵。我就接分吧。
------解决方案--------------------
up