|
@@ -26,7 +26,7 @@ public static class GridControlEx
|
|
|
{
|
|
|
class GridTag
|
|
|
{
|
|
|
- public GridTag() { }
|
|
|
+ public GridTag() { }
|
|
|
public PopupMenu PopupMenu { get; set; }
|
|
|
|
|
|
public BarManager BarM { get; set; }
|
|
@@ -76,15 +76,17 @@ public static class GridControlEx
|
|
|
grid.Load += (sender, e) =>
|
|
|
{
|
|
|
var frm = grid.FindForm();
|
|
|
- if (frm == null) return;
|
|
|
- frm.FormClosing += (sender2, e2) =>
|
|
|
+ if (frm != null)
|
|
|
{
|
|
|
- if (e2.CloseReason == CloseReason.UserClosing)
|
|
|
+ frm.FormClosing += (sender2, e2) =>
|
|
|
{
|
|
|
- Directory.CreateDirectory("Layout");
|
|
|
- grid.MainView?.SaveLayoutToXml($"Layout\\{grid.Name}.xml", OptionsLayoutBase.FullLayout);
|
|
|
- }
|
|
|
- };
|
|
|
+ if (e2.CloseReason == CloseReason.UserClosing||e2.CloseReason== CloseReason.MdiFormClosing)
|
|
|
+ {
|
|
|
+ Directory.CreateDirectory("Layout");
|
|
|
+ grid.MainView?.SaveLayoutToXml($"Layout\\{grid.Name}.xml", OptionsLayoutBase.FullLayout);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
};
|
|
|
string file = $"Layout\\{grid.Name}.xml";
|
|
|
if (File.Exists(file))
|