From a786ba6ce91646a756ac5f49a4ebe86f88b882c5 Mon Sep 17 00:00:00 2001 From: wule Date: Sun, 18 Oct 2026 14:22:41 +0800 Subject: [PATCH] =?UTF-8?q?1=E6=96=B0=E7=89=88=E6=9C=AC=202=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=9B=BE=E7=89=87=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Ctrls/OrderCtrls/OrderListRowItemCtrl.xaml.cs | 2 +- AllBase/ImageBuild.cs | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowItemCtrl.xaml.cs b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowItemCtrl.xaml.cs index 23ed643..e12953c 100644 --- a/29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowItemCtrl.xaml.cs +++ b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListRowItemCtrl.xaml.cs @@ -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(() => { diff --git a/AllBase/ImageBuild.cs b/AllBase/ImageBuild.cs index d70b7d5..3311326 100644 --- a/AllBase/ImageBuild.cs +++ b/AllBase/ImageBuild.cs @@ -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()) {