diff --git a/Bin/net40/SunnyUI.Demo.exe b/Bin/net40/SunnyUI.Demo.exe index 58457424..6c19988f 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 fccffa1a..e783458c 100644 Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ diff --git a/SunnyUI.Demo/Controls/FAvatar.cs b/SunnyUI.Demo/Controls/FAvatar.cs index b131377b..e3dfc288 100644 --- a/SunnyUI.Demo/Controls/FAvatar.cs +++ b/SunnyUI.Demo/Controls/FAvatar.cs @@ -11,5 +11,18 @@ { uiContextMenuStrip1.Show(uiAvatar4, 0, uiAvatar4.Height); } + + public override bool SetParam(int fromPageIndex, params object[] objects) + { + if (fromPageIndex == 1002 && objects.Length == 1) + { + uiLabel1.Text = objects[0].ToString(); + return true; + } + else + { + return false; + } + } } } diff --git a/SunnyUI.Demo/Controls/FButton.Designer.cs b/SunnyUI.Demo/Controls/FButton.Designer.cs index 4124f5b7..cdb52c9c 100644 --- a/SunnyUI.Demo/Controls/FButton.Designer.cs +++ b/SunnyUI.Demo/Controls/FButton.Designer.cs @@ -355,7 +355,6 @@ namespace Sunny.UI.Demo this.uiSymbolButton21.Name = "uiSymbolButton21"; this.uiSymbolButton21.RadiusSides = Sunny.UI.UICornerRadiusSides.None; this.uiSymbolButton21.Size = new System.Drawing.Size(46, 35); - this.uiSymbolButton21.Style = Sunny.UI.UIStyle.Custom; this.uiSymbolButton21.Symbol = 61520; this.uiSymbolButton21.TabIndex = 98; this.uiSymbolButton21.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); @@ -369,7 +368,6 @@ namespace Sunny.UI.Demo this.uiSymbolButton13.Name = "uiSymbolButton13"; this.uiSymbolButton13.RadiusSides = Sunny.UI.UICornerRadiusSides.None; this.uiSymbolButton13.Size = new System.Drawing.Size(46, 35); - this.uiSymbolButton13.Style = Sunny.UI.UIStyle.Custom; this.uiSymbolButton13.Symbol = 61518; this.uiSymbolButton13.TabIndex = 97; this.uiSymbolButton13.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); @@ -1156,6 +1154,7 @@ namespace Sunny.UI.Demo this.uiButton1.Text = "White"; this.uiButton1.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.uiButton1.TipsText = "1"; + this.uiButton1.Click += new System.EventHandler(this.uiButton1_Click); // // uiToolTip1 // diff --git a/SunnyUI.Demo/Controls/FButton.cs b/SunnyUI.Demo/Controls/FButton.cs index dc7f8cc4..d9ea27a7 100644 --- a/SunnyUI.Demo/Controls/FButton.cs +++ b/SunnyUI.Demo/Controls/FButton.cs @@ -63,5 +63,12 @@ namespace Sunny.UI.Demo { Frame.SelectPage(5000); } + + private void uiButton1_Click(object sender, EventArgs e) + { + //传值给页面1001 + //设置FAvatar的Label文字 + Frame.SetParamToPage(1001, PageIndex, "你好"); + } } } diff --git a/SunnyUI/Forms/UIForm.cs b/SunnyUI/Forms/UIForm.cs index 31b11069..d2eb6c9d 100644 --- a/SunnyUI/Forms/UIForm.cs +++ b/SunnyUI/Forms/UIForm.cs @@ -28,6 +28,7 @@ * 2021-08-17: V3.0.6 适应主屏幕任务栏在屏幕各个方向均可 * 2021-08-17: V3.0.8 增加IFrame接口 * 2022-01-03: V3.0.9 标题栏按钮可以设置颜色 + * 2022-02-09: V3.1.0 增加页面间传值方法SetParamToPage ******************************************************************************/ using System; @@ -1921,19 +1922,19 @@ namespace Sunny.UI public UITabControl MainTabControl { get; set; } - public virtual UIPage AddPage(UIPage page, int index) + public UIPage AddPage(UIPage page, int index) { page.PageIndex = index; return AddPage(page); } - public virtual UIPage AddPage(UIPage page, Guid guid) + public UIPage AddPage(UIPage page, Guid guid) { page.PageGuid = guid; return AddPage(page); } - public virtual UIPage AddPage(UIPage page) + public UIPage AddPage(UIPage page) { page.Frame = this; MainTabControl?.AddPage(page); @@ -1950,40 +1951,53 @@ namespace Sunny.UI MainTabControl?.SelectPage(guid); } - public virtual bool RemovePage(int pageIndex) + public bool RemovePage(int pageIndex) { return MainTabControl?.RemovePage(pageIndex) ?? false; } - public virtual bool RemovePage(Guid guid) + public bool RemovePage(Guid guid) { return MainTabControl?.RemovePage(guid) ?? false; } - public virtual void Feedback(object sender, int pageIndex, params object[] objects) + public virtual void FeedbackFormPage(int fromPageIndex, params object[] objects) { } - public virtual UIPage GetPage(int pageIndex) + public UIPage GetPage(int pageIndex) { return MainTabControl?.GetPage(pageIndex); } - public virtual UIPage GetPage(Guid guid) + public UIPage GetPage(Guid guid) { return MainTabControl?.GetPage(guid); } - public virtual bool ExistPage(int pageIndex) + public bool ExistPage(int pageIndex) { return GetPage(pageIndex) != null; } - public virtual bool ExistPage(Guid guid) + public bool ExistPage(Guid guid) { return GetPage(guid) != null; } + public bool SetParamToPage(int toPageIndex, int fromPageIndex, params object[] objects) + { + UIPage page = GetPage(toPageIndex); + if (page == null) return false; + return page.SetParam(fromPageIndex, objects); + } + + public bool SetParamToPage(Guid toPageGuid, Guid fromPageGuid, params object[] objects) + { + UIPage page = GetPage(toPageGuid); + if (page == null) return false; + return page.SetParam(fromPageGuid, objects); + } #endregion IFrame实现 } diff --git a/SunnyUI/Frames/IFrame.cs b/SunnyUI/Frames/IFrame.cs index 52629366..35adecb8 100644 --- a/SunnyUI/Frames/IFrame.cs +++ b/SunnyUI/Frames/IFrame.cs @@ -47,10 +47,14 @@ namespace Sunny.UI bool RemovePage(Guid guid); - void Feedback(object sender, int pageIndex, params object[] objects); + void FeedbackFormPage(int fromPageIndex, params object[] objects); bool ExistPage(int index); bool ExistPage(Guid guid); + + bool SetParamToPage(int toPageIndex, int fromPageIndex, params object[] objects); + + bool SetParamToPage(Guid toPageGuid, Guid fromPageGuid, params object[] objects); } } diff --git a/SunnyUI/Frames/UIPage.cs b/SunnyUI/Frames/UIPage.cs index 76bf871d..ba335aed 100644 --- a/SunnyUI/Frames/UIPage.cs +++ b/SunnyUI/Frames/UIPage.cs @@ -639,14 +639,19 @@ namespace Sunny.UI get; set; } - public void Feedback(object sender, params object[] objects) + public void FeedbackToFrame(params object[] objects) { - Frame?.Feedback(this, PageIndex, objects); + Frame?.FeedbackFormPage(PageIndex, objects); } - public virtual void SetParam(int fromPageIndex, params object[] objects) + public virtual bool SetParam(int fromPageIndex, params object[] objects) { + return false; + } + public virtual bool SetParam(Guid fromPageGuid, params object[] objects) + { + return false; } #region 一些辅助窗口