如何用 gdi+ 实现winform任务管理器中的cpu占有率图或者内存使用率图    真是超难得问题    帮个忙嘛,各位大哥

解决方案 »

  1.   

    string strDotName=File1.PostedFile.FileName.Substring(File1.PostedFile.FileName.ToString().Length-4,4);
    Random ro = new Random(System.DateTime.Now.GetHashCode());
    string strFileName="image"+ro.Next()+strDotName;
    File1.PostedFile.SaveAs(this.Server.MapPath("upload/"+strFileName));//图片上传结束,下面生成缩略图
    System.Drawing.Image.GetThumbnailImageAbort myCallback =new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
    Bitmap myBitmap = new Bitmap(this.Server.MapPath("upload/")+"\\"+strFileName);
    Bitmap tomap=new Bitmap(Server.MapPath("images/logo.gif"));
    System.Drawing.Image myThumbnail = myBitmap.GetThumbnailImage(200,150,myCallback,IntPtr.Zero);
    Response.ContentType="image/jpeg";
    Bitmap newbmp=new Bitmap(myThumbnail);
    Graphics g=Graphics.FromImage(newbmp);
    g.DrawImageUnscaled(tomap,0,0,200,150); Random ro1 = new Random(System.DateTime.Now.GetHashCode());
    string strName="image"+ro1.Next()+".jpg"; newbmp.Save(this.Server.MapPath("upload/"+strName),System.Drawing.Imaging.ImageFormat.Jpeg);
    myBitmap.Dispose();
    tomap.Dispose();
    newbmp.Dispose();