『DotNet吧』

『DotNet』

导航

预览大尺寸图片的解决方案

Posted on 2007-07-12 01:53  鱿鱼  阅读(235)  评论(0)    收藏  举报

System.Drawing.Image img = System.Drawing.Image.FromFile(photoPath);
            
int width = Convert.ToInt32(img.Width);
            
int height = Convert.ToInt32(img.Height);
            
if (width > 400)
            
{
                
this.Image1.Width = 400;
            }

            
this.Image1.ImageUrl = photoPath ;