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.En
wpf中常常需要给控件添加背景图片,下边以wrapPanel为例,使用代码添加背景图片 WrapPanel xwraPanel = new WrapPanel(); ImageBrush ximgBrush = new ImageBrush(); Uri xuri = new Uri("pack://application:,,,/Images/JXimgs/MeterLayout.png", UriKind.Absolute); //注意这个的写法 ximgBrush.ImageSo