diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll
index c867a620..39a1d408 100644
Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ
diff --git a/SunnyUI/Forms/UIForm.cs b/SunnyUI/Forms/UIForm.cs
index 987a413b..b0b84bad 100644
--- a/SunnyUI/Forms/UIForm.cs
+++ b/SunnyUI/Forms/UIForm.cs
@@ -411,7 +411,7 @@ namespace Sunny.UI
protected override void OnMouseClick(MouseEventArgs e)
{
- if (FormBorderStyle == FormBorderStyle.None)
+ if (FormBorderStyle == FormBorderStyle.None && ShowTitle)
{
if (InControlBox)
{
diff --git a/SunnyUI/SunnyUI.csproj b/SunnyUI/SunnyUI.csproj
index 3f5932d2..5950f25c 100644
--- a/SunnyUI/SunnyUI.csproj
+++ b/SunnyUI/SunnyUI.csproj
@@ -431,6 +431,7 @@
+
diff --git a/SunnyUI/Units/UJson.cs b/SunnyUI/Units/UJson.cs
new file mode 100644
index 00000000..e7e7c87e
--- /dev/null
+++ b/SunnyUI/Units/UJson.cs
@@ -0,0 +1,73 @@
+/******************************************************************************
+ * SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
+ * CopyRight (C) 2012-2020 ShenYongHua(沈永华).
+ * QQ群:56829229 QQ:17612584 EMail:SunnyUI@qq.com
+ *
+ * Blog: https://www.cnblogs.com/yhuse
+ * Gitee: https://gitee.com/yhuse/SunnyUI
+ * GitHub: https://github.com/yhuse/SunnyUI
+ *
+ * SunnyUI.dll can be used for free under the GPL-3.0 license.
+ * If you use this code, please keep this note.
+ * 如果您使用此代码,请保留此说明。
+ ******************************************************************************
+ * 文件名称: UJson.cs
+ * 文件说明: Json扩展类,不引用第三方组件实现简单的Json字符串和对象的转换
+ * 当前版本: V2.2
+ * 创建日期: 2020-10-21
+ *
+ * 2020-10-21: V2.2.9 增加文件说明
+******************************************************************************/
+
+using System;
+using System.IO;
+using System.Text;
+using System.Web.Script.Serialization;
+
+namespace Sunny.UI
+{
+ public static class Json
+ {
+ public static T Deserialize(string input)
+ {
+ try
+ {
+ JavaScriptSerializer js = new JavaScriptSerializer();
+ return js.Deserialize(input);
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e.Message);
+ return default(T);
+ }
+ }
+
+ public static string Serialize(object obj)
+ {
+ JavaScriptSerializer js = new JavaScriptSerializer();
+ return js.Serialize(obj);
+ }
+
+ public static T DeserializeFromFile(string filename, Encoding encoding)
+ {
+ string jsonStr = File.ReadAllText(filename, encoding);
+ return Deserialize(jsonStr);
+ }
+
+ public static string SerializeToFile(object obj, string filename, Encoding encoding)
+ {
+ string jsonStr = Serialize(obj);
+ try
+ {
+ DirEx.CreateDir(Path.GetDirectoryName(filename));
+ File.WriteAllText(filename, jsonStr, encoding);
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e.Message);
+ }
+
+ return jsonStr;
+ }
+ }
+}
diff --git a/SunnyUI/Units/UJsonConfig.cs b/SunnyUI/Units/UJsonConfig.cs
index 3cb23abe..c6ef11f0 100644
--- a/SunnyUI/Units/UJsonConfig.cs
+++ b/SunnyUI/Units/UJsonConfig.cs
@@ -22,7 +22,6 @@
using System;
using System.IO;
using System.Text;
-using System.Web.Script.Serialization;
namespace Sunny.UI
{
@@ -54,9 +53,7 @@ namespace Sunny.UI
try
{
- string jsonStr = File.ReadAllText(filename, Encoding.Default);
- JavaScriptSerializer js = new JavaScriptSerializer();
- current = js.Deserialize(jsonStr);
+ current = Json.DeserializeFromFile(filename, Encoding.Default);
return true;
}
catch (Exception ex)
@@ -80,10 +77,7 @@ namespace Sunny.UI
throw new ApplicationException($"未指定{typeof(TConfig).Name}的配置文件路径!");
}
- JavaScriptSerializer js = new JavaScriptSerializer();
- string jsonStr = js.Serialize(current);
- DirEx.CreateDir(Path.GetDirectoryName(filename));
- File.WriteAllText(filename, jsonStr, Encoding.Default);
+ Json.SerializeToFile(current, filename, Encoding.Default);
}
}
}
\ No newline at end of file