* UIForm:增加WindowStateChange事件判断WindowState状态,调整ShowFullScreen全屏显示

This commit is contained in:
Sunny 2020-06-22 21:49:51 +08:00
parent 604d8f3167
commit 3c40a20952
9 changed files with 18 additions and 9 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -78,6 +78,7 @@
this.uiLogo1.MinimumSize = new System.Drawing.Size(300, 80);
this.uiLogo1.Name = "uiLogo1";
this.uiLogo1.Size = new System.Drawing.Size(300, 80);
this.uiLogo1.Style = Sunny.UI.UIStyle.Custom;
this.uiLogo1.TabIndex = 3;
this.uiLogo1.Text = "uiLogo1";
//
@ -99,6 +100,7 @@
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FMain";
this.Text = "SunnyUI.Net";
this.WindowStateChange += new Sunny.UI.UIForm.OnWindowStateChange(this.FMain_WindowStateChange);
this.Header.ResumeLayout(false);
this.ResumeLayout(false);

View File

@ -80,5 +80,10 @@ namespace Sunny.UI.Demo
break;
}
}
private void FMain_WindowStateChange(object sender, FormWindowState state)
{
state.ConsoleWriteLine("WindowState");
}
}
}

View File

@ -37,6 +37,10 @@ namespace Sunny.UI
private UIStatusForm statusForm;
public delegate void OnWindowStateChange(object sender, FormWindowState state);
public event OnWindowStateChange WindowStateChange;
public UIForm()
{
InitializeComponent();
@ -462,6 +466,7 @@ namespace Sunny.UI
if (InMinBox)
{
base.WindowState = FormWindowState.Minimized;
WindowStateChange?.Invoke(this,FormWindowState.Minimized);
InMinBox = false;
}
@ -495,10 +500,10 @@ namespace Sunny.UI
Height = ShowFullScreen ? screen.Bounds.Height : screen.WorkingArea.Height;
Left = screen.Bounds.Left;
Top = screen.Bounds.Top;
//StartPosition = FormStartPosition.Manual;
SetFormRoundRectRegion(this, 0);
TopMost = ShowFullScreen;
windowState = FormWindowState.Maximized;
WindowStateChange?.Invoke(this, FormWindowState.Maximized);
}
else if (windowState == FormWindowState.Maximized)
{
@ -513,9 +518,9 @@ namespace Sunny.UI
if (location.X == 0 && location.Y == 0) location = center;
Location = StartPosition == FormStartPosition.CenterScreen ? center : location;
//StartPosition = FormStartPosition.CenterScreen;
SetFormRoundRectRegion(this, ShowRadius ? 5 : 0);
windowState = FormWindowState.Normal;
WindowStateChange?.Invoke(this, FormWindowState.Normal);
}
Invalidate();
@ -1110,11 +1115,6 @@ namespace Sunny.UI
public string CloseAskString { get; set; }
private void UIForm_Shown(object sender, EventArgs e)
{
//SetStyle(UIStyles.Style);
}
private FormWindowState windowState = FormWindowState.Normal;
public new FormWindowState WindowState

View File

@ -39,7 +39,6 @@
this.Name = "UIForm";
this.Text = "UIForm";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.UIForm_FormClosing);
this.Shown += new System.EventHandler(this.UIForm_Shown);
this.ResumeLayout(false);
}

View File

@ -1,5 +1,8 @@
+ 增加; - 删除; * 修改
2020.06.22
* UIForm增加WindowStateChange事件判断WindowState状态调整ShowFullScreen全屏显示
2020.06.21
+ UIMessageTipHelper增加MessageTip扩展方法
+ UILoginForm登录窗体增加两张图片