110,538
社区成员
发帖
与我相关
我的任务
分享
MemoryStream ms = new MemoryStream();
bmp.Save(ms, ImageFormat.Jpeg);
bmp = new Bitmap(ms);
Graphics g = Graphics.FromImage(bmp);
g.SmoothingMode = SmoothingMode.AntiAlias;
Pen mypen=null;
if (线元素类型 == "省界")
{
mypen = new Pen(Color.Black, 4);
}
else if (线元素类型 == "市界")
{
mypen = new Pen(Color.Gray, 3);
}
else if(线元素类型 == "县界")
{
mypen = new Pen(Color.LightGray, 2);
}
else if (线元素类型 == "河流界")
{
mypen = new Pen(Color.Blue, 2);
}
GraphicsPath myPath = new GraphicsPath();
for (int i = 0; i < 线元素.Count; i++)
{
GraphicsPath tmpPath= new GraphicsPath();
if (线元素[i].Length > 1)//
{
tmpPath.AddLines(线元素[i]);
myPath.AddPath(tmpPath, false);//首尾不追加
}
tmpPath.Dispose();
}
g.DrawPath(mypen, myPath);//一次性绘出myPath
g.Dispose();
mypen.Dispose();
myPath.Dispose();
ms.Dispose();