using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Text;
引入命名空间
string path = Server.MapPath(@"~/images/jbbjtu.jpg");//得到图片的路径
System.Drawing.Image imgSrc = System.Drawing.Image.FromFile(path);
Font font = new Font("宋体", 12);//字体大小;
SolidBrush solid = new SolidBrush(Color.Black);//字体颜色
Graphics g = Graphics.FromImage(imgSrc);
Pen le = new Pen(Color.Black,1);//定义画笔
Rectangle line_Rect = new Rectangle(xnum-Convert.ToInt32(jp_lt_rt)+10, peny1, font_w, font_h);//范围
g.DrawString(dai_name, font, solid, line_Rect); //得到家族的名字
g.DrawLine(le, new Point(xnum-Convert.ToInt32(jp_lt_rt) , peny1+ Convert.ToInt32(jp_up_dw)/2 ),new Point(penx2+2800, peny1+Convert.ToInt32(jp_up_dw)/2));
g.DrawLine(le, new Point(xnum -10 , peny1-Convert.ToInt32(jp_up_dw)), new Point(xnum - 10, peny1+Convert.ToInt32(jp_up_dw)));
/**得到URL的图片地址**/
System.Net.WebClient client = new System.Net.WebClient();
Stream stream = client.OpenRead(no1path);
System.Drawing.Image img_logo = System.Drawing.Image.FromStream(stream);
/**end**///加载本地的图片
System.Drawing.Image img_logo = System.Drawing.Image.FromFile(no1path);
/*绘制图片*/
Rectangle drawRect = new Rectangle(no1x,no1y, font_w, font_h);
Rectangle drawrect2 = new Rectangle(no1x2,no1y2,font_w,font_h);
g.DrawImage(img_juxing, new Rectangle(xnum, iy, img_juxing.Width, img_juxing.Height), 0, 0, img_juxing.Width, img_juxing.Height, GraphicsUnit.Pixel);//得到矩形;
g.DrawImage(img_logo,xnum,iy,logo_w,logo_h);
g.DrawString(no1name, font, solid, drawRect); //得到家族的名字
g.DrawString(no1birthday, font, solid, drawrect2);//得到家族代的生日
//最后记的释放内存
g.Dispose();
imgSrc.Dispose();
Img_jiapu.Dispose();