using System;
using System.Drawing;
using System.Drawing.Imaging;
namespace UcaspCount
  {
public class Images
 {
string _ofileName="";
string _nfileName="";
public string ofileName
 {
 get {
return _ofileName;
}
set
 {
_ofileName=value;
}
}
public string nfileName
 {
get
 {
return _nfileName;
}
set
 {
_nfileName=value;
}
}
 public Image images() {
//得到图片
Image oFile=Image.FromFile(ofileName);
Image thumbnailImage=oFile.GetThumbnailImage(200,100,new Image.GetThumbnailImageAbort(callback),IntPtr.Zero);
return thumbnailImage;
}
public void MyImage()
 {
Image nFile=Image.FromFile(nfileName);
Bitmap newFile= new Bitmap(images());
Graphics g= Graphics.FromImage(newFile);
//g.DrawString("aaa",new Font("Courier New",14),new SolidBrush(Color.Red),10,20);该句就是在图片上写文字
g.DrawImage(nFile,new Rectangle(10,10,10,10),30,30,100,100,GraphicsUnit.Pixel);//在图片上加一个小图片;
newFile.Save(nfileName,System.Drawing.Imaging.ImageFormat.Jpeg);//保存道nfileName位置
}
 public bool callback() {
return false;
}
}
}
发表于
2005-04-12 15:51
祥子哥哥
阅读( 926)
评论()
收藏
举报
|