1新版本 2优化图片显示
This commit is contained in:
1 parent
41b240c066
commit
a786ba6ce9
2 files changed
+8
-3
No files matched your search
@@ -787,7 +787,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
// 异步加载图片防止卡顿
|
||||
// 缩略图在有的电脑上无法显示
|
||||
//BitmapImage bImg = ImageUrlToBitmapImageConverter.LoadImageFromUrl(order_item.thumb_img + "?imageView2/1/w/100/format/webp|imageMogr2/auto-orient=");
|
||||
BitmapImage bImg = AllBase.ImageBuild.LoadBitmipImageFromUrl(order_item.thumb_img);
|
||||
BitmapImage bImg = AllBase.ImageBuild.LoadBitmipImageFromUrl(order_item.thumb_img, 100, 100);
|
||||
Thread.Sleep(Randomx.GetId(1000));
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
|
||||
@@ -385,11 +385,16 @@ namespace AllBase
|
||||
}
|
||||
}
|
||||
|
||||
public static BitmapImage LoadBitmipImageFromUrl(string url)
|
||||
public static BitmapImage LoadBitmipImageFromUrl(string url, int? width = 0, int? height = 0)
|
||||
{
|
||||
BitmapImage bitmap = new BitmapImage();
|
||||
if (width != null && height != null)
|
||||
{
|
||||
bitmap.DecodePixelWidth = 100;
|
||||
bitmap.DecodePixelHeight = 100;
|
||||
}
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
using (WebClient webClient = new WebClient())
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user