* UIMainFrame:页面框架增加Selecting事件,在页面切换时执行该事件
This commit is contained in:
parent
3ee1b0f1af
commit
1fac28592f
BIN
Bin/SunnyUI.dll
BIN
Bin/SunnyUI.dll
Binary file not shown.
BIN
Bin/SunnyUI.pdb
BIN
Bin/SunnyUI.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
2
SunnyUI.Demo/FMain.Designer.cs
generated
2
SunnyUI.Demo/FMain.Designer.cs
generated
@ -93,6 +93,7 @@
|
||||
this.uiAvatar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.uiAvatar.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiAvatar.Location = new System.Drawing.Point(939, 25);
|
||||
this.uiAvatar.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiAvatar.Name = "uiAvatar";
|
||||
this.uiAvatar.Size = new System.Drawing.Size(66, 70);
|
||||
this.uiAvatar.TabIndex = 4;
|
||||
@ -110,6 +111,7 @@
|
||||
this.ShowRadius = false;
|
||||
this.ShowShadow = true;
|
||||
this.Text = "SunnyUI.Net";
|
||||
this.Selecting += new Sunny.UI.UIMainFrame.OnSelecting(this.FMain_Selecting);
|
||||
this.Header.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
|
@ -87,5 +87,10 @@ namespace Sunny.UI.Demo
|
||||
{
|
||||
state.ConsoleWriteLine("WindowState");
|
||||
}
|
||||
|
||||
private void FMain_Selecting(object sender, TabControlCancelEventArgs e, UIPage page)
|
||||
{
|
||||
page?.Text.ConsoleWriteLine();
|
||||
}
|
||||
}
|
||||
}
|
3
SunnyUI/Frames/UIMainFrame.Designer.cs
generated
3
SunnyUI/Frames/UIMainFrame.Designer.cs
generated
@ -48,6 +48,7 @@
|
||||
this.MainContainer.Size = new System.Drawing.Size(800, 415);
|
||||
this.MainContainer.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
|
||||
this.MainContainer.TabIndex = 0;
|
||||
this.MainContainer.Selecting += new System.Windows.Forms.TabControlCancelEventHandler(this.MainContainer_Selecting);
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
@ -63,7 +64,7 @@
|
||||
this.tabPage2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
||||
this.tabPage2.Location = new System.Drawing.Point(0, 40);
|
||||
this.tabPage2.Name = "tabPage2";
|
||||
this.tabPage2.Size = new System.Drawing.Size(800, 375);
|
||||
this.tabPage2.Size = new System.Drawing.Size(450, 230);
|
||||
this.tabPage2.TabIndex = 1;
|
||||
this.tabPage2.Text = "tabPage2";
|
||||
//
|
||||
|
@ -20,7 +20,9 @@
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
@ -31,6 +33,7 @@ namespace Sunny.UI
|
||||
InitializeComponent();
|
||||
MainContainer.TabVisible = false;
|
||||
MainContainer.BringToFront();
|
||||
MainContainer.TabPages.Clear();
|
||||
}
|
||||
|
||||
protected override void OnShown(EventArgs e)
|
||||
@ -83,5 +86,19 @@ namespace Sunny.UI
|
||||
get => MainContainer.ShowActiveCloseButton;
|
||||
set => MainContainer.ShowActiveCloseButton = value;
|
||||
}
|
||||
|
||||
private void MainContainer_Selecting(object sender, TabControlCancelEventArgs e)
|
||||
{
|
||||
if (Selecting != null)
|
||||
{
|
||||
List<UIPage> pages = e.TabPage.GetControls<UIPage>();
|
||||
Selecting?.Invoke(this, e, pages.Count == 0 ? null : pages[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void OnSelecting(object sender, TabControlCancelEventArgs e, UIPage page);
|
||||
|
||||
[Description("页面选择事件"), Category("SunnyUI")]
|
||||
public event OnSelecting Selecting;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user