不知道大家试过没有,代码如下: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); drawstring(); } public void drawstring() { Image img = this.BackgroundImage; Graphics g = Graphics.FromImage(img); Font yh = new Font("微软雅黑", 12); Font st = new Font("宋体", 12); Font f1 = new Font(yh, FontStyle.Underline); Font f2 = new Font(st, FontStyle.Underline); g.DrawString("设置宝宝头像", f1, new SolidBrush(ForeColor), new PointF(120, 340)); g.DrawString("设置宝宝头像", f2, new SolidBrush(ForeColor), new PointF(120, 370)); } } }你试试在没有安装雅黑的机器上,2个大小差狠多
这个我做一个项目时遇到的问题。可以参考看看。
不过和你的可能有些不一样
一般来说,还是用每个系统都可能有的字体比较好,不容易出问题
System.Drawing.Text.InstalledFontCollection ifc = new System.Drawing.Text.InstalledFontCollection();
int count = ifc.Families.Length;获得.
你要说对方明明没有你硬是成成功调用,我相信bill.gates也做不到.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
drawstring();
} public void drawstring()
{
Image img = this.BackgroundImage;
Graphics g = Graphics.FromImage(img); Font yh = new Font("微软雅黑", 12);
Font st = new Font("宋体", 12); Font f1 = new Font(yh, FontStyle.Underline);
Font f2 = new Font(st, FontStyle.Underline);
g.DrawString("设置宝宝头像", f1, new SolidBrush(ForeColor), new PointF(120, 340));
g.DrawString("设置宝宝头像", f2, new SolidBrush(ForeColor), new PointF(120, 370)); }
}
}你试试在没有安装雅黑的机器上,2个大小差狠多