Silverlight:获取图像大小
答
我已经下载的Silverlight 3测试版,其提供有参数,可以显示实际图像dimentions事件ImageOpened
答
怎么样 - 在你的代码后面的文件(.xaml.cs)重新加载图像到一个新的图像控制,并从中取得的宽度和高度?
事情是这样的:
System.Windows.Controls.Image img = new System.Windows.Controls.Image();
string UriValue = HtmlPage.Document.DocumentUri.AbsoluteUri + imagefilename;
img.SetValue(System.Windows.Controls.Image.SourceProperty,
new System.Windows.Media.Imaging.BitmapImage(new Uri(UriValue)));
double imagewidth = img.Width;
你的意思是什么尺寸?文件大小?宽度高度? – 2009-04-14 13:13:05
宽度和高度(更新了问题) – Drahcir 2009-04-14 13:35:09