首页 > 代码库 > WPF Image控件使用本地图片

WPF Image控件使用本地图片

        BitmapImage bi = new BitmapImage();            // BitmapImage.UriSource must be in a BeginInit/EndInit block.            bi.BeginInit();            StreamResourceInfo info = Application.GetRemoteStream(new Uri("Test.jpg", UriKind.Relative));            bi.StreamSource = info.Stream;            bi.EndInit();            // Set the image source.            IMTest.Source = bi;