string[] list1={path+"0.bmp",path+"1.bmp",path+"2.bmp"};
第一次
list1[0]=path"0.bmp"
第二次
list1[1]=path"0.bmp1.bmp"
第三次
list1[2]=path"0.bmp1.bmp2.bmp"
能不出错么?
第一次
list1[0]=path"0.bmp"
第二次
list1[1]=path"0.bmp1.bmp"
第三次
list1[2]=path"0.bmp1.bmp2.bmp"
能不出错么?
{
string path = @"c:\";
string[] list1 ={ path + "0.bmp", path + "1.bmp", path + "2.bmp" };
for (int i = 0; i < list1.Length; i++)
{
using (System.Drawing.Image image = System.Drawing.Image.FromFile(list1[i].ToString()))
{
System.Drawing.Graphics g = Graphics.FromImage(image);
GraphicsPath gp = new GraphicsPath();
g.CompositingQuality = CompositingQuality.HighQuality;
Pen pen = new Pen(Color.Red, 1); FontFamily family = new FontFamily("宋体"); //字体
int fontStyle = 0; //字体样式
////字体大小
//if (size == 0)
//{
// size = 56;
//}
Point origin = new Point(20, 20); //文本的起始点,即左上角
StringFormat format = StringFormat.GenericTypographic; //默认的文本格式 string text = "Red_angelX";
gp.AddString(text, family, fontStyle, 56, origin, format); //向路径添加文本字符串
g.CompositingQuality = CompositingQuality.GammaCorrected;
g.FillPath(new SolidBrush(Color.Black), gp);//屏蔽次句代码,画出空心文字
g.DrawPath(pen, gp); //把路径画出来 g.Dispose(); gp.Dispose(); try
{
image.Save("c:\\test\\" + i + ".bmp", System.Drawing.Imaging.ImageFormat.Jpeg);
//释放资源
}
catch (Exception E)
{
throw new Exception(E.Message);
}
image.Dispose();
pen.Dispose();
}
}
}这样再Winform下调了下代码灭有问题啊...