我想要按比例更改我在asp.net中圖像的大小,問題是我無法獲取從數據庫加載的圖像的實際大小。這裏是代碼:如何獲取圖像控件的寬度和高度
imgAvatar.ImageUrl = "~/Modules/FileViewer.ashx?id=" + o.EventID;
double r = imgAvatar.Width.Value/300.00;
imgAvatar.Width = new Unit(300, UnitType.Pixel);
imgAvatar.Height = new Unit(imgAvatar.Height.Value/r, UnitType.Pixel);
但imgAvatar.Width.Value
總是0.0。 你會對我建議什麼?
你應該做的FileViewer.ashx調整,據我可以看到,處理程序提供圖像,那麼爲什麼不調整它的大小呢? – 2012-02-09 12:22:51