2010-06-25 37 views
0

第一个: 你知道我为什么无法获取FromFile方法吗? 例如:我不能写Image.FromFile关于C#中图像的信息WPF

第二: 你知道我怎么能在c#WPF中获得图像尺寸吗?

回答

1

使用下面的代码来获得图像的尺寸

BitmapImage image = new BitmapImage(new Uri(@"c:\Images\Image1.JPG")); 
double width = image.Width; 
double height = image.Height;