* UIForm2: 更新

This commit is contained in:
Sunny 2024-01-25 22:43:00 +08:00
parent feb8182a25
commit 882dbb3f40
8 changed files with 944 additions and 123 deletions

View File

@ -946,22 +946,6 @@ namespace Sunny.UI
get; set;
}
protected override void OnActivated(EventArgs e)
{
base.OnActivated(e);
IsActive = true;
Invalidate();
}
protected override void OnDeactivate(EventArgs e)
{
base.OnDeactivate(e);
IsActive = false;
Invalidate();
}
protected bool IsActive;
/// <summary>
/// 重载绘图
/// </summary>

View File

@ -13,6 +13,16 @@
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
this.UnRegister();
if (hotKeys != null)
{
foreach (var hotKey in hotKeys.Values)
{
Win32.User.UnregisterHotKey(System.IntPtr.Zero, hotKey.id);
}
}
if (disposing && (components != null))
{
components.Dispose();
@ -35,6 +45,7 @@
AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
ClientSize = new System.Drawing.Size(800, 450);
Icon = Sunny.UI.Properties.Resources.SunnyUI;
Name = "UIForm2";
Padding = new System.Windows.Forms.Padding(0, 35, 0, 0);
Text = "UIForm2";

File diff suppressed because it is too large Load Diff

View File

@ -190,6 +190,16 @@ namespace Sunny.UI.Properties {
}
}
/// <summary>
/// 查找类似于 (图标) 的 System.Drawing.Icon 类型的本地化资源。
/// </summary>
internal static System.Drawing.Icon SunnyUI {
get {
object obj = ResourceManager.GetObject("SunnyUI", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>

View File

@ -157,6 +157,9 @@
<data name="notifier" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\notifier.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="SunnyUI" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\SunnyUI.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="wind" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\wind.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

View File

@ -35,8 +35,6 @@ namespace Sunny.UI
{
UIStyle Style { get; set; }
bool StyleCustomMode { get; set; }
string Version { get; }
string TagString { get; set; }
@ -483,51 +481,5 @@ namespace Sunny.UI
return values;
}
public static void SetRawControlStyle(ControlEventArgs e, UIStyle style)
{
if (e.Control is TableLayoutPanel)
{
List<Control> controls = e.Control.GetUIStyleControls("IStyleInterface");
foreach (var control in controls)
{
if (control is IStyleInterface item)
{
if (!item.StyleCustomMode)
item.Style = style;
}
}
return;
}
if (e.Control is FlowLayoutPanel)
{
List<Control> controls = e.Control.GetUIStyleControls("IStyleInterface");
foreach (var control in controls)
{
if (control is IStyleInterface item)
{
if (!item.StyleCustomMode)
item.Style = style;
}
}
return;
}
if (e.Control is Panel)
{
List<Control> controls = e.Control.GetUIStyleControls("IStyleInterface");
foreach (var control in controls)
{
if (control is IStyleInterface item)
{
if (!item.StyleCustomMode)
item.Style = style;
}
}
}
}
}
}

View File

@ -207,6 +207,8 @@ namespace Sunny.UI
private static readonly ConcurrentDictionary<UIStyle, UIBaseStyle> Styles = new ConcurrentDictionary<UIStyle, UIBaseStyle>();
private static readonly ConcurrentDictionary<Guid, UIForm> Forms = new ConcurrentDictionary<Guid, UIForm>();
private static readonly ConcurrentDictionary<Guid, UIPage> Pages = new ConcurrentDictionary<Guid, UIPage>();
private static readonly ConcurrentDictionary<Guid, UIForm2> Forms2 = new ConcurrentDictionary<Guid, UIForm2>();
/// <summary>
/// 菜单颜色集合
@ -295,6 +297,21 @@ namespace Sunny.UI
return false;
}
/// <summary>
/// 注册窗体
/// </summary>
/// <param name="form">窗体</param>
public static bool Register(this UIForm2 form)
{
if (!Forms2.ContainsKey(form.Guid))
{
Forms2.Upsert(form.Guid, form);
return true;
}
return false;
}
/// <summary>
/// 注册页面
/// </summary>
@ -331,6 +348,15 @@ namespace Sunny.UI
Forms.TryRemove(form.Guid, out _);
}
/// <summary>
/// 反注册窗体
/// </summary>
/// <param name="form">窗体</param>
public static void UnRegister(this UIForm2 form)
{
Forms2.TryRemove(form.Guid, out _);
}
/// <summary>
/// 反注册页面
/// </summary>