提交当前本机整理版本

This commit is contained in:
cyf
2026-07-02 10:11:39 +00:00
parent c10a5d64c7
commit aacefa24f8
822 changed files with 196665 additions and 14263 deletions
@@ -575,4 +575,40 @@ public static class LabPicUrlPreview
// 为避免对流的依赖,先 Image.FromStream,再复制
using (Image img = Image.FromStream(ms))
{
return new B
return new Bitmap(img);
}
}
}
private static Image ScaleBitmap(Bitmap src, int targetHeight)
{
int h = targetHeight <= 0 ? 30 : targetHeight;
if (h < 18) h = 18;
double ratio = (double)h / (double)src.Height;
int w = (int)Math.Round((double)src.Width * ratio);
if (w < 1) w = 1;
return new Bitmap(src, new Size(w, h));
}
private static Image CopyBitmap(Bitmap src)
{
return new Bitmap(src);
}
private static void BeginInvokeSafe(System.Windows.Forms.Control c, Action action)
{
if (action == null) return;
try
{
if (c != null && !c.IsDisposed)
c.BeginInvoke(action);
else
action();
}
catch
{
try { action(); } catch { }
}
}
}
}