diff --git a/Bin/net40/SunnyUI.Demo.exe b/Bin/net40/SunnyUI.Demo.exe
index 3ebfc904..f98190eb 100644
Binary files a/Bin/net40/SunnyUI.Demo.exe and b/Bin/net40/SunnyUI.Demo.exe differ
diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll
index db287faa..257a87d9 100644
Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ
diff --git a/Bin/net5.0-windows/SunnyUI.dll b/Bin/net5.0-windows/SunnyUI.dll
index e850947d..2f311ee8 100644
Binary files a/Bin/net5.0-windows/SunnyUI.dll and b/Bin/net5.0-windows/SunnyUI.dll differ
diff --git a/Bin/net5.0-windows/ref/SunnyUI.dll b/Bin/net5.0-windows/ref/SunnyUI.dll
index a0ee880f..77052d35 100644
Binary files a/Bin/net5.0-windows/ref/SunnyUI.dll and b/Bin/net5.0-windows/ref/SunnyUI.dll differ
diff --git a/Bin/netcoreapp3.1/SunnyUI.dll b/Bin/netcoreapp3.1/SunnyUI.dll
index e4ceebc5..de500e3a 100644
Binary files a/Bin/netcoreapp3.1/SunnyUI.dll and b/Bin/netcoreapp3.1/SunnyUI.dll differ
diff --git a/SunnyUI/Static/UImage.cs b/SunnyUI/Static/UImage.cs
index 24846012..8cab0a08 100644
--- a/SunnyUI/Static/UImage.cs
+++ b/SunnyUI/Static/UImage.cs
@@ -20,11 +20,13 @@
******************************************************************************/
using System;
+using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Net;
+using System.Text;
using System.Windows.Forms;
namespace Sunny.UI
@@ -40,6 +42,54 @@ namespace Sunny.UI
///
public static class ImageEx
{
+ ///
+ /// 获取打开文件对话框所有的图片类型过滤条件
+ /// ------
+ /// All Images|*.BMP;*.DIB;*.RLE;*.JPG;*.JPEG;*.JPE;*.JFIF;*.GIF;*.TIF;*.TIFF;*.PNG|
+ /// BMP Files: (*.BMP;*.DIB;*.RLE)|*.BMP;*.DIB;*.RLE|
+ /// JPEG Files: (*.JPG;*.JPEG;*.JPE;*.JFIF)|*.JPG;*.JPEG;*.JPE;*.JFIF|
+ /// GIF Files: (*.GIF)|*.GIF|
+ /// TIFF Files: (*.TIF;*.TIFF)|*.TIF;*.TIFF|
+ /// PNG Files: (*.PNG)|*.PNG|
+ /// All Files|*.*
+ /// ------
+ ///
+ ///
+ public static string GetImageFilter()
+ {
+ StringBuilder allImageExtensions = new StringBuilder();
+ string separator = "";
+ ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders();
+ Dictionary images = new Dictionary();
+ foreach (ImageCodecInfo codec in codecs)
+ {
+ allImageExtensions.Append(separator);
+ allImageExtensions.Append(codec.FilenameExtension);
+ separator = ";";
+ images.Add(string.Format("{0} Files: ({1})", codec.FormatDescription, codec.FilenameExtension), codec.FilenameExtension);
+ }
+
+ StringBuilder sb = new StringBuilder();
+ if (allImageExtensions.Length > 0)
+ {
+ sb.AppendFormat("{0}|{1}", "All Images", allImageExtensions.ToString());
+ }
+
+ images.Add("All Files", "*.*");
+ foreach (KeyValuePair image in images)
+ {
+ sb.AppendFormat("|{0}|{1}", image.Key, image.Value);
+ }
+
+ return sb.ToString();
+ }
+
+ public static Color RandomColor()
+ {
+ Random random = new Random();
+ return Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
+ }
+
public static Bitmap ChangeOpacity(Image img, float opacity)
{
Bitmap bmp = new Bitmap(img.Width, img.Height); // Determining Width and Height of Source Image