2020-05-11 21:11:29 +08:00
|
|
|
|
/******************************************************************************
|
|
|
|
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
2022-01-02 12:32:50 +08:00
|
|
|
|
* CopyRight (C) 2012-2022 ShenYongHua(沈永华).
|
2021-02-20 15:45:47 +08:00
|
|
|
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
2020-05-11 21:11:29 +08:00
|
|
|
|
*
|
|
|
|
|
* Blog: https://www.cnblogs.com/yhuse
|
|
|
|
|
* Gitee: https://gitee.com/yhuse/SunnyUI
|
|
|
|
|
* GitHub: https://github.com/yhuse/SunnyUI
|
|
|
|
|
*
|
|
|
|
|
* SunnyUI.dll can be used for free under the GPL-3.0 license.
|
|
|
|
|
* If you use this code, please keep this note.
|
|
|
|
|
* 如果您使用此代码,请保留此说明。
|
|
|
|
|
******************************************************************************
|
|
|
|
|
* 文件名称: UIPage.cs
|
|
|
|
|
* 文件说明: 页面基类,从Form继承,可放置于容器内
|
2022-01-05 21:57:47 +08:00
|
|
|
|
* 当前版本: V3.1
|
2020-05-11 21:11:29 +08:00
|
|
|
|
* 创建日期: 2020-01-01
|
|
|
|
|
*
|
|
|
|
|
* 2020-01-01: V2.2.0 增加文件说明
|
2021-08-17 16:55:01 +08:00
|
|
|
|
* 2021-05-21: V3.0.4 更改了下页面切换重复执行的Init事件调用
|
|
|
|
|
* 2021-06-20: V3.0.4 增加标题行,替代UITitlePage
|
|
|
|
|
* 2021-07-18: V3.0.5 修复OnLoad在加载时重复加载两次的问题,增加Final函数,每次页面切换,退出页面都会执行
|
|
|
|
|
* 2021-08-17: V3.0.6 增加TitleFont属性
|
2021-08-26 10:27:53 +08:00
|
|
|
|
* 2021-08-24: V3.0.6 修复OnLoad在加载时重复加载两次的问题
|
2021-12-01 19:18:49 +08:00
|
|
|
|
* 2021-12-01: V3.0.9 增加FeedBack和SetParam函数,用于多页面传值
|
2021-12-30 13:48:07 +08:00
|
|
|
|
* 2021-12-30: V3.0.9 增加NeedReload,页面切换是否需要重载Load
|
2022-04-02 23:59:34 +08:00
|
|
|
|
* 2022-04-02: V3.1.2 默认设置AutoScaleMode为None
|
2022-04-26 15:48:47 +08:00
|
|
|
|
* 2022-04-26: V3.1.8 屏蔽一些属性
|
2022-05-11 11:11:52 +08:00
|
|
|
|
* 2022-05-11: V3.1.8 ShowTitle时,可调整Padding
|
2022-06-11 17:00:13 +08:00
|
|
|
|
* 2022-06-11: V3.1.9 弹窗默认关闭半透明遮罩
|
2020-05-11 21:11:29 +08:00
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.ComponentModel;
|
2020-06-05 22:42:48 +08:00
|
|
|
|
using System.Diagnostics;
|
2020-05-11 21:11:29 +08:00
|
|
|
|
using System.Drawing;
|
2020-06-09 20:15:39 +08:00
|
|
|
|
using System.Drawing.Design;
|
2020-05-11 21:11:29 +08:00
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Sunny.UI
|
|
|
|
|
{
|
|
|
|
|
[DefaultEvent("Initialize")]
|
2022-04-11 13:18:21 +08:00
|
|
|
|
public partial class UIPage : Form, IStyleInterface, ISymbol, IZoomScale
|
2020-05-11 21:11:29 +08:00
|
|
|
|
{
|
2020-06-05 22:42:48 +08:00
|
|
|
|
public readonly Guid Guid = Guid.NewGuid();
|
|
|
|
|
private Color _rectColor = UIColor.Blue;
|
|
|
|
|
|
|
|
|
|
private ToolStripStatusLabelBorderSides _rectSides = ToolStripStatusLabelBorderSides.None;
|
|
|
|
|
|
|
|
|
|
protected UIStyle _style = UIStyle.Blue;
|
|
|
|
|
|
2021-03-25 14:49:21 +08:00
|
|
|
|
[Browsable(false)]
|
2021-07-16 10:42:07 +08:00
|
|
|
|
public IFrame Frame
|
|
|
|
|
{
|
|
|
|
|
get; set;
|
|
|
|
|
}
|
2020-11-09 23:41:41 +08:00
|
|
|
|
|
2020-05-11 21:11:29 +08:00
|
|
|
|
public UIPage()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
2020-06-05 22:42:48 +08:00
|
|
|
|
TopLevel = false;
|
|
|
|
|
if (this.Register()) SetStyle(UIStyles.Style);
|
2020-05-11 21:11:29 +08:00
|
|
|
|
|
|
|
|
|
SetStyle(ControlStyles.UserPaint, true);
|
|
|
|
|
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
|
|
|
|
SetStyle(ControlStyles.DoubleBuffer, true);
|
|
|
|
|
UpdateStyles();
|
|
|
|
|
|
2020-06-05 22:42:48 +08:00
|
|
|
|
if (!IsDesignMode) base.Dock = DockStyle.Fill;
|
2020-05-11 21:11:29 +08:00
|
|
|
|
|
|
|
|
|
Version = UIGlobal.Version;
|
2021-10-16 20:39:12 +08:00
|
|
|
|
SetDPIScale();
|
2022-03-20 17:16:40 +08:00
|
|
|
|
|
|
|
|
|
BackColor = UIStyles.Blue.PageBackColor;
|
|
|
|
|
_rectColor = UIStyles.Blue.PageRectColor;
|
|
|
|
|
ForeColor = UIStyles.Blue.PageForeColor;
|
|
|
|
|
titleFillColor = UIStyles.Blue.PageTitleFillColor;
|
|
|
|
|
titleForeColor = UIStyles.Blue.PageTitleForeColor;
|
2022-04-26 15:48:47 +08:00
|
|
|
|
base.WindowState = FormWindowState.Normal;
|
|
|
|
|
base.TopMost = false;
|
|
|
|
|
base.FormBorderStyle = FormBorderStyle.None;
|
|
|
|
|
base.AutoScroll = false;
|
|
|
|
|
base.ShowIcon = false;
|
|
|
|
|
base.ShowInTaskbar = false;
|
|
|
|
|
base.StartPosition = FormStartPosition.Manual;
|
|
|
|
|
base.SizeGripStyle = SizeGripStyle.Hide;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public new IButtonControl AcceptButton
|
|
|
|
|
{
|
|
|
|
|
get => base.AcceptButton;
|
|
|
|
|
set => base.AcceptButton = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public new IButtonControl CancelButton
|
|
|
|
|
{
|
|
|
|
|
get => base.CancelButton;
|
|
|
|
|
set => base.CancelButton = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public new SizeGripStyle SizeGripStyle
|
|
|
|
|
{
|
|
|
|
|
get => base.SizeGripStyle;
|
|
|
|
|
set => base.SizeGripStyle = SizeGripStyle.Hide;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public new FormStartPosition StartPosition
|
|
|
|
|
{
|
|
|
|
|
get => base.StartPosition;
|
|
|
|
|
set => base.StartPosition = FormStartPosition.Manual;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public new bool AutoScroll
|
|
|
|
|
{
|
|
|
|
|
get => base.AutoScroll;
|
|
|
|
|
set => base.AutoScroll = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public new bool ShowIcon
|
|
|
|
|
{
|
|
|
|
|
get => base.ShowIcon;
|
|
|
|
|
set => base.ShowIcon = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public new bool ShowInTaskbar
|
|
|
|
|
{
|
|
|
|
|
get => base.ShowInTaskbar;
|
|
|
|
|
set => base.ShowInTaskbar = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public new bool IsMdiContainer
|
|
|
|
|
{
|
|
|
|
|
get => base.IsMdiContainer;
|
|
|
|
|
set => base.IsMdiContainer = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//不显示FormBorderStyle属性
|
|
|
|
|
[Browsable(false)]
|
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
|
|
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
|
|
|
|
public new FormBorderStyle FormBorderStyle
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return base.FormBorderStyle;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (!Enum.IsDefined(typeof(FormBorderStyle), value))
|
|
|
|
|
throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(FormBorderStyle));
|
|
|
|
|
base.FormBorderStyle = FormBorderStyle.None;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
|
|
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
|
|
|
|
public new bool TopMost
|
|
|
|
|
{
|
|
|
|
|
get => base.TopMost;
|
|
|
|
|
set => base.TopMost = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 不显示WindowState属性
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Browsable(false)]
|
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
|
|
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
|
|
|
|
public new FormWindowState WindowState
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return base.WindowState;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
base.WindowState = FormWindowState.Normal;
|
|
|
|
|
}
|
2021-10-16 20:39:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-04-14 17:18:45 +08:00
|
|
|
|
public UIPage SetPageIndex(int pageIndex)
|
|
|
|
|
{
|
|
|
|
|
PageIndex = pageIndex;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public UIPage SetPageGuid(Guid pageGuid)
|
|
|
|
|
{
|
|
|
|
|
PageGuid = pageGuid;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public UIPage SetText(string text)
|
|
|
|
|
{
|
|
|
|
|
Text = text;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-23 23:27:55 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 禁止控件跟随窗体缩放
|
|
|
|
|
/// </summary>
|
2022-04-07 16:13:17 +08:00
|
|
|
|
[DefaultValue(false), Category("SunnyUI"), Description("禁止控件跟随窗体缩放")]
|
2022-04-11 13:18:21 +08:00
|
|
|
|
public bool ZoomScaleDisabled { get; set; }
|
2022-04-07 16:13:17 +08:00
|
|
|
|
|
2022-06-23 23:27:55 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 控件缩放前在其容器里的位置
|
|
|
|
|
/// </summary>
|
2022-04-07 17:49:50 +08:00
|
|
|
|
[Browsable(false)]
|
2022-04-11 13:18:21 +08:00
|
|
|
|
public Rectangle ZoomScaleRect { get; set; }
|
2022-04-07 16:13:17 +08:00
|
|
|
|
|
2022-06-23 23:27:55 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置控件缩放比例
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="scale">缩放比例</param>
|
2022-04-11 13:18:21 +08:00
|
|
|
|
public virtual void SetZoomScale(float scale)
|
2022-04-07 16:13:17 +08:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-20 22:38:37 +08:00
|
|
|
|
[Browsable(false)]
|
2021-10-16 20:39:12 +08:00
|
|
|
|
public bool IsScaled { get; private set; }
|
|
|
|
|
|
|
|
|
|
public void SetDPIScale()
|
|
|
|
|
{
|
2022-04-07 16:13:17 +08:00
|
|
|
|
if (DesignMode) return;
|
2021-10-16 20:39:12 +08:00
|
|
|
|
if (!IsScaled)
|
|
|
|
|
{
|
|
|
|
|
this.SetDPIScaleFont();
|
2022-03-29 18:26:37 +08:00
|
|
|
|
if (!UIDPIScale.DPIScaleIsOne())
|
2021-11-17 23:46:56 +08:00
|
|
|
|
{
|
2022-03-29 23:55:38 +08:00
|
|
|
|
this.TitleFont = TitleFont.DPIScaleFont();
|
2021-11-17 23:46:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-10-16 20:39:12 +08:00
|
|
|
|
foreach (Control control in this.GetAllDPIScaleControls())
|
|
|
|
|
{
|
2022-03-17 22:31:09 +08:00
|
|
|
|
if (control is UIDataGridView dgv)
|
|
|
|
|
{
|
|
|
|
|
dgv.SetDPIScale();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
control.SetDPIScaleFont();
|
|
|
|
|
}
|
2021-10-16 20:39:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IsScaled = true;
|
|
|
|
|
}
|
2020-05-11 21:11:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-04-03 12:20:11 +08:00
|
|
|
|
public void ResetDPIScale()
|
2022-03-13 23:16:06 +08:00
|
|
|
|
{
|
|
|
|
|
IsScaled = false;
|
|
|
|
|
SetDPIScale();
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-11 21:46:38 +08:00
|
|
|
|
public void Render()
|
|
|
|
|
{
|
|
|
|
|
SetStyle(UIStyles.Style);
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-09 20:15:39 +08:00
|
|
|
|
private int _symbolSize = 24;
|
|
|
|
|
|
2022-06-23 23:27:55 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 字体图标大小
|
|
|
|
|
/// </summary>
|
2020-06-09 20:15:39 +08:00
|
|
|
|
[DefaultValue(24)]
|
2021-03-22 21:31:14 +08:00
|
|
|
|
[Description("字体图标大小"), Category("SunnyUI")]
|
2020-06-09 20:15:39 +08:00
|
|
|
|
public int SymbolSize
|
|
|
|
|
{
|
|
|
|
|
get => _symbolSize;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_symbolSize = Math.Max(value, 16);
|
2021-07-18 22:29:01 +08:00
|
|
|
|
_symbolSize = Math.Min(value, 128);
|
2020-06-09 20:15:39 +08:00
|
|
|
|
SymbolChange();
|
|
|
|
|
Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int _symbol;
|
|
|
|
|
|
2022-06-23 23:27:55 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 字体图标
|
|
|
|
|
/// </summary>
|
2020-06-09 20:15:39 +08:00
|
|
|
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
2022-01-18 11:29:57 +08:00
|
|
|
|
[Editor("Sunny.UI.UIImagePropertyEditor, " + AssemblyRefEx.SystemDesign, typeof(UITypeEditor))]
|
2020-06-09 20:15:39 +08:00
|
|
|
|
[DefaultValue(0)]
|
2021-03-22 21:31:14 +08:00
|
|
|
|
[Description("字体图标"), Category("SunnyUI")]
|
2020-06-09 20:15:39 +08:00
|
|
|
|
public int Symbol
|
|
|
|
|
{
|
|
|
|
|
get => _symbol;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_symbol = value;
|
|
|
|
|
SymbolChange();
|
|
|
|
|
Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-15 13:54:31 +08:00
|
|
|
|
private Point symbolOffset = new Point(0, 0);
|
|
|
|
|
|
2022-06-23 23:27:55 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 字体图标的偏移位置
|
|
|
|
|
/// </summary>
|
2021-07-15 13:54:31 +08:00
|
|
|
|
[DefaultValue(typeof(Point), "0, 0")]
|
|
|
|
|
[Description("字体图标的偏移位置"), Category("SunnyUI")]
|
|
|
|
|
public Point SymbolOffset
|
|
|
|
|
{
|
|
|
|
|
get => symbolOffset;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
symbolOffset = value;
|
|
|
|
|
Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-22 21:31:14 +08:00
|
|
|
|
[DefaultValue(false), Description("在Frame框架中不被关闭"), Category("SunnyUI")]
|
2021-07-16 10:42:07 +08:00
|
|
|
|
public bool AlwaysOpen
|
|
|
|
|
{
|
|
|
|
|
get; set;
|
|
|
|
|
}
|
2020-06-27 16:53:32 +08:00
|
|
|
|
|
2020-06-09 20:15:39 +08:00
|
|
|
|
protected virtual void SymbolChange()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-22 21:31:14 +08:00
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public Point ParentLocation { get; set; } = new Point(0, 0);
|
2020-05-11 21:11:29 +08:00
|
|
|
|
|
2020-06-09 20:15:39 +08:00
|
|
|
|
[DefaultValue(-1)]
|
2020-06-05 22:42:48 +08:00
|
|
|
|
public int PageIndex { get; set; } = -1;
|
|
|
|
|
|
2020-06-09 20:15:39 +08:00
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public Guid PageGuid { get; set; } = Guid.Empty;
|
|
|
|
|
|
|
|
|
|
[Browsable(false), DefaultValue(null)]
|
|
|
|
|
public TabPage TabPage { get; set; } = null;
|
|
|
|
|
|
2020-06-05 22:42:48 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 边框颜色
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The color of the border style.</value>
|
2021-03-22 21:31:14 +08:00
|
|
|
|
[Description("边框颜色"), Category("SunnyUI")]
|
2020-06-05 22:42:48 +08:00
|
|
|
|
public Color RectColor
|
|
|
|
|
{
|
|
|
|
|
get => _rectColor;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_rectColor = value;
|
|
|
|
|
AfterSetRectColor(value);
|
|
|
|
|
_style = UIStyle.Custom;
|
|
|
|
|
Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected bool IsDesignMode
|
2020-05-11 21:11:29 +08:00
|
|
|
|
{
|
2020-06-05 22:42:48 +08:00
|
|
|
|
get
|
2020-05-11 21:11:29 +08:00
|
|
|
|
{
|
2020-06-05 22:42:48 +08:00
|
|
|
|
var ReturnFlag = false;
|
|
|
|
|
if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
|
|
|
|
|
ReturnFlag = true;
|
|
|
|
|
else if (Process.GetCurrentProcess().ProcessName == "devenv")
|
|
|
|
|
ReturnFlag = true;
|
|
|
|
|
|
|
|
|
|
return ReturnFlag;
|
2020-05-11 21:11:29 +08:00
|
|
|
|
}
|
2020-06-05 22:42:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[DefaultValue(ToolStripStatusLabelBorderSides.None)]
|
2021-03-22 21:31:14 +08:00
|
|
|
|
[Description("边框显示位置"), Category("SunnyUI")]
|
2020-06-05 22:42:48 +08:00
|
|
|
|
public ToolStripStatusLabelBorderSides RectSides
|
|
|
|
|
{
|
|
|
|
|
get => _rectSides;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_rectSides = value;
|
|
|
|
|
Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-08 21:55:50 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Tag字符串
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DefaultValue(null)]
|
|
|
|
|
[Description("获取或设置包含有关控件的数据的对象字符串"), Category("SunnyUI")]
|
2021-07-16 10:42:07 +08:00
|
|
|
|
public string TagString
|
|
|
|
|
{
|
|
|
|
|
get; set;
|
|
|
|
|
}
|
2020-06-05 22:42:48 +08:00
|
|
|
|
|
2021-07-16 10:42:07 +08:00
|
|
|
|
public string Version
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
}
|
2020-06-05 22:42:48 +08:00
|
|
|
|
|
2020-08-08 21:55:50 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 主题样式
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")]
|
2020-06-05 22:42:48 +08:00
|
|
|
|
public UIStyle Style
|
|
|
|
|
{
|
|
|
|
|
get => _style;
|
|
|
|
|
set => SetStyle(value);
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-08 21:55:50 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 自定义主题风格
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DefaultValue(false)]
|
|
|
|
|
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
2021-07-16 10:42:07 +08:00
|
|
|
|
public bool StyleCustomMode
|
|
|
|
|
{
|
|
|
|
|
get; set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public event EventHandler Initialize;
|
2021-11-17 23:46:56 +08:00
|
|
|
|
|
2021-07-18 00:06:47 +08:00
|
|
|
|
public event EventHandler Finalize;
|
2020-06-05 22:42:48 +08:00
|
|
|
|
|
2020-05-11 21:11:29 +08:00
|
|
|
|
protected override void OnControlAdded(ControlEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnControlAdded(e);
|
|
|
|
|
if (e.Control is IStyleInterface ctrl)
|
2020-06-09 20:15:39 +08:00
|
|
|
|
{
|
2021-07-18 15:06:59 +08:00
|
|
|
|
if (!ctrl.StyleCustomMode) ctrl.Style = Style;
|
2020-06-09 20:15:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-07-18 15:06:59 +08:00
|
|
|
|
UIStyleHelper.SetRawControlStyle(e, Style);
|
2021-06-20 23:21:24 +08:00
|
|
|
|
|
|
|
|
|
if (AllowShowTitle && !AllowAddControlOnTitle && e.Control.Top < TitleHeight)
|
|
|
|
|
{
|
|
|
|
|
e.Control.Top = Padding.Top;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[DefaultValue(false)]
|
|
|
|
|
[Description("允许在标题栏放置控件"), Category("SunnyUI")]
|
|
|
|
|
public bool AllowAddControlOnTitle
|
|
|
|
|
{
|
|
|
|
|
get; set;
|
2020-05-11 21:11:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void Init()
|
|
|
|
|
{
|
2021-07-18 00:06:47 +08:00
|
|
|
|
Initialize?.Invoke(this, new EventArgs());
|
2021-05-21 11:23:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnLoad(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnLoad(e);
|
|
|
|
|
Init();
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-24 13:44:32 +08:00
|
|
|
|
private bool IsShown;
|
|
|
|
|
|
|
|
|
|
protected override void OnShown(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnShown(e);
|
2022-04-02 23:59:34 +08:00
|
|
|
|
if (AutoScaleMode == AutoScaleMode.Font) AutoScaleMode = AutoScaleMode.None;
|
2021-08-24 13:44:32 +08:00
|
|
|
|
IsShown = true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-21 11:23:20 +08:00
|
|
|
|
public void ReLoad()
|
|
|
|
|
{
|
2021-12-30 13:48:07 +08:00
|
|
|
|
if (IsShown)
|
|
|
|
|
{
|
|
|
|
|
if (NeedReload)
|
|
|
|
|
OnLoad(EventArgs.Empty);
|
|
|
|
|
else
|
|
|
|
|
Init();
|
|
|
|
|
}
|
2021-05-21 18:15:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-12-30 13:48:07 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 字体颜色
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Description("页面切换是否需要重载Load"), Category("SunnyUI")]
|
|
|
|
|
[DefaultValue(false)]
|
|
|
|
|
public bool NeedReload { get; set; }
|
|
|
|
|
|
2020-05-11 21:11:29 +08:00
|
|
|
|
public virtual void Final()
|
|
|
|
|
{
|
2021-07-18 00:06:47 +08:00
|
|
|
|
Finalize?.Invoke(this, new EventArgs());
|
2022-06-11 16:17:07 +08:00
|
|
|
|
|
|
|
|
|
foreach (var item in this.GetControls<UIComboBox>(true))
|
|
|
|
|
{
|
|
|
|
|
item.HideFilterForm();
|
|
|
|
|
}
|
2020-05-11 21:11:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetStyle(UIStyle style)
|
|
|
|
|
{
|
2021-07-18 22:29:01 +08:00
|
|
|
|
this.SuspendLayout();
|
2021-07-18 15:06:59 +08:00
|
|
|
|
UIStyleHelper.SetChildUIStyle(this, style);
|
2020-05-11 21:11:29 +08:00
|
|
|
|
|
2022-03-20 17:16:40 +08:00
|
|
|
|
if (!style.IsCustom())
|
|
|
|
|
{
|
|
|
|
|
SetStyleColor(style.Colors());
|
|
|
|
|
Invalidate();
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-11 21:11:29 +08:00
|
|
|
|
_style = style;
|
2021-02-28 21:06:15 +08:00
|
|
|
|
UIStyleChanged?.Invoke(this, new EventArgs());
|
2021-07-18 22:29:01 +08:00
|
|
|
|
this.ResumeLayout();
|
2020-05-11 21:11:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-02-28 21:06:15 +08:00
|
|
|
|
public event EventHandler UIStyleChanged;
|
|
|
|
|
|
2020-05-11 21:11:29 +08:00
|
|
|
|
public virtual void SetStyleColor(UIBaseStyle uiColor)
|
|
|
|
|
{
|
2022-03-20 17:16:40 +08:00
|
|
|
|
BackColor = uiColor.PageBackColor;
|
|
|
|
|
_rectColor = uiColor.PageRectColor;
|
|
|
|
|
ForeColor = uiColor.PageForeColor;
|
|
|
|
|
titleFillColor = uiColor.PageTitleFillColor;
|
|
|
|
|
titleForeColor = uiColor.PageTitleForeColor;
|
2020-05-11 21:11:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual void AfterSetFillColor(Color color)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual void AfterSetRectColor(Color color)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual void AfterSetForeColor(Color color)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-24 15:04:08 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 重载绘图
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="e">绘图参数</param>
|
2020-05-11 21:11:29 +08:00
|
|
|
|
protected override void OnPaint(PaintEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnPaint(e);
|
|
|
|
|
|
2020-06-05 22:42:48 +08:00
|
|
|
|
if (Width <= 0 || Height <= 0) return;
|
2020-05-11 21:11:29 +08:00
|
|
|
|
|
2021-06-20 23:21:24 +08:00
|
|
|
|
if (AllowShowTitle)
|
|
|
|
|
{
|
|
|
|
|
e.Graphics.FillRectangle(TitleFillColor, 0, 0, Width, TitleHeight);
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-11 21:11:29 +08:00
|
|
|
|
if (RectSides != ToolStripStatusLabelBorderSides.None)
|
|
|
|
|
{
|
|
|
|
|
if (RectSides.GetValue(ToolStripStatusLabelBorderSides.Left))
|
|
|
|
|
e.Graphics.DrawLine(RectColor, 0, 0, 0, Height - 1);
|
|
|
|
|
if (RectSides.GetValue(ToolStripStatusLabelBorderSides.Top))
|
|
|
|
|
e.Graphics.DrawLine(RectColor, 0, 0, Width - 1, 0);
|
|
|
|
|
if (RectSides.GetValue(ToolStripStatusLabelBorderSides.Right))
|
|
|
|
|
e.Graphics.DrawLine(RectColor, Width - 1, 0, Width - 1, Height - 1);
|
|
|
|
|
if (RectSides.GetValue(ToolStripStatusLabelBorderSides.Bottom))
|
|
|
|
|
e.Graphics.DrawLine(RectColor, 0, Height - 1, Width - 1, Height - 1);
|
|
|
|
|
}
|
2021-06-20 23:21:24 +08:00
|
|
|
|
|
|
|
|
|
if (!AllowShowTitle) return;
|
|
|
|
|
if (Symbol > 0)
|
|
|
|
|
{
|
2021-07-15 13:54:31 +08:00
|
|
|
|
e.Graphics.DrawFontImage(Symbol, SymbolSize, TitleForeColor, new Rectangle(ImageInterval, 0, SymbolSize, TitleHeight), SymbolOffset.X, SymbolOffset.Y);
|
2021-06-20 23:21:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-08-16 16:42:16 +08:00
|
|
|
|
SizeF sf = e.Graphics.MeasureString(Text, TitleFont);
|
|
|
|
|
e.Graphics.DrawString(Text, TitleFont, TitleForeColor,
|
2021-06-20 23:21:24 +08:00
|
|
|
|
Symbol > 0 ? ImageInterval * 2 + SymbolSize : ImageInterval, (TitleHeight - sf.Height) / 2);
|
|
|
|
|
|
|
|
|
|
e.Graphics.SetHighQuality();
|
|
|
|
|
if (ControlBox)
|
|
|
|
|
{
|
|
|
|
|
if (InControlBox)
|
|
|
|
|
{
|
|
|
|
|
e.Graphics.FillRectangle(UIColor.Red, ControlBoxRect);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
e.Graphics.DrawLine(Color.White,
|
|
|
|
|
ControlBoxRect.Left + ControlBoxRect.Width / 2 - 5,
|
|
|
|
|
ControlBoxRect.Top + ControlBoxRect.Height / 2 - 5,
|
|
|
|
|
ControlBoxRect.Left + ControlBoxRect.Width / 2 + 5,
|
|
|
|
|
ControlBoxRect.Top + ControlBoxRect.Height / 2 + 5);
|
|
|
|
|
e.Graphics.DrawLine(Color.White,
|
|
|
|
|
ControlBoxRect.Left + ControlBoxRect.Width / 2 - 5,
|
|
|
|
|
ControlBoxRect.Top + ControlBoxRect.Height / 2 + 5,
|
|
|
|
|
ControlBoxRect.Left + ControlBoxRect.Width / 2 + 5,
|
|
|
|
|
ControlBoxRect.Top + ControlBoxRect.Height / 2 - 5);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnMouseClick(MouseEventArgs e)
|
|
|
|
|
{
|
2021-07-26 11:45:06 +08:00
|
|
|
|
base.OnMouseClick(e);
|
|
|
|
|
|
2021-06-20 23:21:24 +08:00
|
|
|
|
if (FormBorderStyle == FormBorderStyle.None && ShowTitle)
|
|
|
|
|
{
|
|
|
|
|
if (InControlBox)
|
|
|
|
|
{
|
|
|
|
|
InControlBox = false;
|
|
|
|
|
Close();
|
|
|
|
|
AfterClose();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void AfterClose()
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Close");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Color titleFillColor = Color.FromArgb(76, 76, 76);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 填充颜色,当值为背景色或透明色或空值则不填充
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Description("标题颜色"), Category("SunnyUI")]
|
|
|
|
|
[DefaultValue(typeof(Color), "76, 76, 76")]
|
|
|
|
|
public Color TitleFillColor
|
|
|
|
|
{
|
|
|
|
|
get => titleFillColor;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
titleFillColor = value;
|
|
|
|
|
Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Color titleForeColor = Color.White;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 字体颜色
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Description("字体颜色"), Category("SunnyUI")]
|
|
|
|
|
[DefaultValue(typeof(Color), "White")]
|
|
|
|
|
public Color TitleForeColor
|
|
|
|
|
{
|
|
|
|
|
get => titleForeColor;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
titleForeColor = value;
|
|
|
|
|
Invalidate();
|
2021-08-16 16:42:16 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 标题字体
|
|
|
|
|
/// </summary>
|
2022-01-02 12:19:45 +08:00
|
|
|
|
private Font titleFont = UIFontColor.Font();
|
2021-08-16 16:42:16 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 标题字体
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Description("标题字体"), Category("SunnyUI")]
|
|
|
|
|
[DefaultValue(typeof(Font), "微软雅黑, 12pt")]
|
|
|
|
|
public Font TitleFont
|
|
|
|
|
{
|
|
|
|
|
get => titleFont;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
titleFont = value;
|
|
|
|
|
Invalidate();
|
2021-06-20 23:21:24 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int imageInterval = 6;
|
|
|
|
|
|
|
|
|
|
public int ImageInterval
|
|
|
|
|
{
|
|
|
|
|
get => imageInterval;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
imageInterval = Math.Max(2, value);
|
|
|
|
|
Invalidate();
|
|
|
|
|
}
|
2020-05-11 21:11:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnBackColorChanged(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnBackColorChanged(e);
|
|
|
|
|
AfterSetFillColor(BackColor);
|
|
|
|
|
_style = UIStyle.Custom;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnForeColorChanged(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnForeColorChanged(e);
|
|
|
|
|
AfterSetForeColor(ForeColor);
|
|
|
|
|
_style = UIStyle.Custom;
|
|
|
|
|
}
|
2020-06-05 22:16:56 +08:00
|
|
|
|
|
2021-06-20 23:21:24 +08:00
|
|
|
|
private int titleHeight = 35;
|
|
|
|
|
|
|
|
|
|
[Description("面板高度"), Category("SunnyUI")]
|
|
|
|
|
[DefaultValue(35)]
|
|
|
|
|
public int TitleHeight
|
|
|
|
|
{
|
|
|
|
|
get => titleHeight;
|
|
|
|
|
set
|
|
|
|
|
{
|
2022-04-03 15:44:59 +08:00
|
|
|
|
titleHeight = Math.Max(value, 19);
|
2022-05-11 11:11:52 +08:00
|
|
|
|
Padding = new Padding(Padding.Left, ShowTitle ? Math.Max(titleHeight, Padding.Top) : 0, Padding.Right, Padding.Bottom);
|
2021-06-20 23:21:24 +08:00
|
|
|
|
CalcSystemBoxPos();
|
|
|
|
|
Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnSizeChanged(EventArgs e)
|
2020-06-05 22:16:56 +08:00
|
|
|
|
{
|
2021-06-20 23:21:24 +08:00
|
|
|
|
base.OnSizeChanged(e);
|
|
|
|
|
CalcSystemBoxPos();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool InControlBox;
|
|
|
|
|
|
|
|
|
|
protected override void OnMouseMove(MouseEventArgs e)
|
|
|
|
|
{
|
2021-07-26 11:45:06 +08:00
|
|
|
|
base.OnMouseMove(e);
|
|
|
|
|
|
2021-06-20 23:21:24 +08:00
|
|
|
|
if (ShowTitle && ControlBox)
|
|
|
|
|
{
|
|
|
|
|
bool inControlBox = e.Location.InRect(ControlBoxRect);
|
|
|
|
|
|
|
|
|
|
if (inControlBox != InControlBox)
|
|
|
|
|
{
|
|
|
|
|
InControlBox = inControlBox;
|
|
|
|
|
Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-06-05 22:16:56 +08:00
|
|
|
|
}
|
2020-09-30 22:43:28 +08:00
|
|
|
|
|
2021-06-20 23:21:24 +08:00
|
|
|
|
protected override void OnPaddingChanged(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnPaddingChanged(e);
|
|
|
|
|
|
|
|
|
|
if (AllowShowTitle)
|
|
|
|
|
{
|
2022-05-11 11:11:52 +08:00
|
|
|
|
Padding = new Padding(Padding.Left, Math.Max(titleHeight, Padding.Top), Padding.Right, Padding.Bottom);
|
2021-06-20 23:21:24 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Description("允许显示标题栏"), Category("SunnyUI"), DefaultValue(false)]
|
|
|
|
|
public bool AllowShowTitle
|
|
|
|
|
{
|
|
|
|
|
get => ShowTitle;
|
|
|
|
|
set => ShowTitle = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否显示窗体的标题栏
|
|
|
|
|
/// </summary>
|
|
|
|
|
private bool showTitle;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否显示窗体的标题栏
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Description("是否显示窗体的标题栏"), Category("WindowStyle"), DefaultValue(false)]
|
|
|
|
|
public bool ShowTitle
|
|
|
|
|
{
|
|
|
|
|
get => showTitle;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
showTitle = value;
|
2022-05-11 11:11:52 +08:00
|
|
|
|
Padding = new Padding(Padding.Left, value ? Math.Max(titleHeight, Padding.Top) : 0, Padding.Right, Padding.Bottom);
|
2021-06-20 23:21:24 +08:00
|
|
|
|
Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnTextChanged(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnTextChanged(e);
|
|
|
|
|
Invalidate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void CalcSystemBoxPos()
|
|
|
|
|
{
|
|
|
|
|
ControlBoxRect = new Rectangle(Width - 6 - 28, titleHeight / 2 - 14, 28, 28);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Rectangle ControlBoxRect;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否显示窗体的控制按钮
|
|
|
|
|
/// </summary>
|
2021-06-20 23:28:59 +08:00
|
|
|
|
private bool controlBox;
|
2021-06-20 23:21:24 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否显示窗体的控制按钮
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Description("是否显示窗体的控制按钮"), Category("WindowStyle"), DefaultValue(false)]
|
|
|
|
|
public new bool ControlBox
|
|
|
|
|
{
|
|
|
|
|
get => controlBox;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
controlBox = value;
|
|
|
|
|
CalcSystemBoxPos();
|
|
|
|
|
Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
2021-07-16 10:42:07 +08:00
|
|
|
|
public new bool MinimizeBox
|
|
|
|
|
{
|
|
|
|
|
get; set;
|
|
|
|
|
}
|
2021-06-20 23:21:24 +08:00
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
2021-07-16 10:42:07 +08:00
|
|
|
|
public new bool MaximizeBox
|
|
|
|
|
{
|
|
|
|
|
get; set;
|
|
|
|
|
}
|
2021-06-20 23:21:24 +08:00
|
|
|
|
|
2022-02-09 18:22:05 +08:00
|
|
|
|
public void FeedbackToFrame(params object[] objects)
|
2021-12-01 19:18:49 +08:00
|
|
|
|
{
|
2022-02-09 18:22:05 +08:00
|
|
|
|
Frame?.FeedbackFormPage(PageIndex, objects);
|
2021-12-01 19:18:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-02-09 18:22:05 +08:00
|
|
|
|
public virtual bool SetParam(int fromPageIndex, params object[] objects)
|
2021-12-01 19:18:49 +08:00
|
|
|
|
{
|
2022-02-09 18:22:05 +08:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2021-12-01 19:18:49 +08:00
|
|
|
|
|
2022-02-09 18:22:05 +08:00
|
|
|
|
public virtual bool SetParam(Guid fromPageGuid, params object[] objects)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
2021-12-01 19:18:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-10-15 20:42:40 +08:00
|
|
|
|
#region 一些辅助窗口
|
2021-04-25 22:04:03 +08:00
|
|
|
|
|
2020-10-15 20:42:40 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 显示进度提示窗
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="desc">描述文字</param>
|
|
|
|
|
/// <param name="maximum">最大进度值</param>
|
2021-04-25 22:04:03 +08:00
|
|
|
|
/// <param name="decimalCount">显示进度条小数个数</param>
|
|
|
|
|
public void ShowStatusForm(int maximum = 100, string desc = "系统正在处理中,请稍候...", int decimalCount = 1)
|
2020-10-15 20:42:40 +08:00
|
|
|
|
{
|
2021-04-25 22:04:03 +08:00
|
|
|
|
UIStatusFormService.ShowStatusForm(maximum, desc, decimalCount);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 隐藏进度提示窗
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void HideStatusForm()
|
|
|
|
|
{
|
|
|
|
|
UIStatusFormService.HideStatusForm();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置进度提示窗步进值加1
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void StatusFormStepIt()
|
|
|
|
|
{
|
|
|
|
|
UIStatusFormService.StepIt();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置进度提示窗描述文字
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="desc">描述文字</param>
|
|
|
|
|
public void SetStatusFormDescription(string desc)
|
|
|
|
|
{
|
|
|
|
|
UIStatusFormService.SetDescription(desc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 显示等待提示窗
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="desc">描述文字</param>
|
|
|
|
|
public void ShowWaitForm(string desc = "系统正在处理中,请稍候...")
|
|
|
|
|
{
|
|
|
|
|
UIWaitFormService.ShowWaitForm(desc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 隐藏等待提示窗
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void HideWaitForm()
|
|
|
|
|
{
|
|
|
|
|
UIWaitFormService.HideWaitForm();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置等待提示窗描述文字
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="desc">描述文字</param>
|
|
|
|
|
public void SetWaitFormDescription(string desc)
|
|
|
|
|
{
|
|
|
|
|
UIWaitFormService.SetDescription(desc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 正确信息提示框
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="msg">信息</param>
|
|
|
|
|
/// <param name="showMask">显示遮罩层</param>
|
2022-06-11 17:00:13 +08:00
|
|
|
|
public void ShowSuccessDialog(string msg, bool showMask = false)
|
2020-10-15 20:42:40 +08:00
|
|
|
|
{
|
2021-05-09 10:36:31 +08:00
|
|
|
|
UIMessageDialog.ShowMessageDialog(msg, UILocalize.SuccessTitle, false, UIStyle.Green, showMask, Frame?.TopMost ?? false);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 信息提示框
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="msg">信息</param>
|
|
|
|
|
/// <param name="showMask">显示遮罩层</param>
|
2022-06-11 17:00:13 +08:00
|
|
|
|
public void ShowInfoDialog(string msg, bool showMask = false)
|
2020-10-15 20:42:40 +08:00
|
|
|
|
{
|
2021-05-09 10:36:31 +08:00
|
|
|
|
UIMessageDialog.ShowMessageDialog(msg, UILocalize.InfoTitle, false, UIStyle.Gray, showMask, Frame?.TopMost ?? false);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 警告信息提示框
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="msg">信息</param>
|
|
|
|
|
/// <param name="showMask">显示遮罩层</param>
|
2022-06-11 17:00:13 +08:00
|
|
|
|
public void ShowWarningDialog(string msg, bool showMask = false)
|
2020-10-15 20:42:40 +08:00
|
|
|
|
{
|
2021-05-09 10:36:31 +08:00
|
|
|
|
UIMessageDialog.ShowMessageDialog(msg, UILocalize.WarningTitle, false, UIStyle.Orange, showMask, Frame?.TopMost ?? false);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 错误信息提示框
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="msg">信息</param>
|
|
|
|
|
/// <param name="showMask">显示遮罩层</param>
|
2022-06-11 17:00:13 +08:00
|
|
|
|
public void ShowErrorDialog(string msg, bool showMask = false)
|
2020-10-15 20:42:40 +08:00
|
|
|
|
{
|
2021-05-09 10:36:31 +08:00
|
|
|
|
UIMessageDialog.ShowMessageDialog(msg, UILocalize.ErrorTitle, false, UIStyle.Red, showMask, Frame?.TopMost ?? false);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 确认信息提示框
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="msg">信息</param>
|
|
|
|
|
/// <param name="showMask">显示遮罩层</param>
|
|
|
|
|
/// <returns>结果</returns>
|
2022-06-11 17:00:13 +08:00
|
|
|
|
public bool ShowAskDialog(string msg, bool showMask = false)
|
2020-10-15 20:42:40 +08:00
|
|
|
|
{
|
2021-05-09 10:36:31 +08:00
|
|
|
|
return UIMessageDialog.ShowMessageDialog(msg, UILocalize.AskTitle, true, UIStyle.Blue, showMask, Frame?.TopMost ?? false);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 正确信息提示框
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="title">标题</param>
|
|
|
|
|
/// <param name="msg">信息</param>
|
|
|
|
|
/// <param name="style">主题</param>
|
|
|
|
|
/// <param name="showMask">显示遮罩层</param>
|
2022-06-11 17:00:13 +08:00
|
|
|
|
public void ShowSuccessDialog(string title, string msg, UIStyle style = UIStyle.Green, bool showMask = false)
|
2020-10-15 20:42:40 +08:00
|
|
|
|
{
|
2021-05-09 10:36:31 +08:00
|
|
|
|
UIMessageDialog.ShowMessageDialog(msg, title, false, style, showMask, Frame?.TopMost ?? false);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 信息提示框
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="title">标题</param>
|
|
|
|
|
/// <param name="msg">信息</param>
|
|
|
|
|
/// <param name="style">主题</param>
|
|
|
|
|
/// <param name="showMask">显示遮罩层</param>
|
2022-06-11 17:00:13 +08:00
|
|
|
|
public void ShowInfoDialog(string title, string msg, UIStyle style = UIStyle.Gray, bool showMask = false)
|
2020-10-15 20:42:40 +08:00
|
|
|
|
{
|
2021-05-09 10:36:31 +08:00
|
|
|
|
UIMessageDialog.ShowMessageDialog(msg, title, false, style, showMask, Frame?.TopMost ?? false);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 警告信息提示框
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="title">标题</param>
|
|
|
|
|
/// <param name="msg">信息</param>
|
|
|
|
|
/// <param name="style">主题</param>
|
|
|
|
|
/// <param name="showMask">显示遮罩层</param>
|
2022-06-11 17:00:13 +08:00
|
|
|
|
public void ShowWarningDialog(string title, string msg, UIStyle style = UIStyle.Orange, bool showMask = false)
|
2020-10-15 20:42:40 +08:00
|
|
|
|
{
|
2021-05-09 10:36:31 +08:00
|
|
|
|
UIMessageDialog.ShowMessageDialog(msg, title, false, style, showMask, Frame?.TopMost ?? false);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 错误信息提示框
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="title">标题</param>
|
|
|
|
|
/// <param name="msg">信息</param>
|
|
|
|
|
/// <param name="style">主题</param>
|
|
|
|
|
/// <param name="showMask">显示遮罩层</param>
|
2022-06-11 17:00:13 +08:00
|
|
|
|
public void ShowErrorDialog(string title, string msg, UIStyle style = UIStyle.Red, bool showMask = false)
|
2020-10-15 20:42:40 +08:00
|
|
|
|
{
|
2021-05-09 10:36:31 +08:00
|
|
|
|
UIMessageDialog.ShowMessageDialog(msg, title, false, style, showMask, Frame?.TopMost ?? false);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 确认信息提示框
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="title">标题</param>
|
|
|
|
|
/// <param name="msg">信息</param>
|
|
|
|
|
/// <param name="style">主题</param>
|
|
|
|
|
/// <param name="showMask">显示遮罩层</param>
|
|
|
|
|
/// <returns>结果</returns>
|
2022-06-11 17:00:13 +08:00
|
|
|
|
public bool ShowAskDialog(string title, string msg, UIStyle style = UIStyle.Blue, bool showMask = false)
|
2020-10-15 20:42:40 +08:00
|
|
|
|
{
|
2021-05-09 10:36:31 +08:00
|
|
|
|
return UIMessageDialog.ShowMessageDialog(msg, title, true, style, showMask, Frame?.TopMost ?? false);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 显示消息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="text">消息文本</param>
|
|
|
|
|
/// <param name="delay">消息停留时长(ms)。默认1秒</param>
|
|
|
|
|
/// <param name="floating">是否漂浮</param>
|
|
|
|
|
public void ShowInfoTip(string text, int delay = 1000, bool floating = true)
|
|
|
|
|
=> UIMessageTip.Show(text, null, delay, floating);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 显示成功消息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="text">消息文本</param>
|
|
|
|
|
/// <param name="delay">消息停留时长(ms)。默认1秒</param>
|
|
|
|
|
/// <param name="floating">是否漂浮</param>
|
|
|
|
|
public void ShowSuccessTip(string text, int delay = 1000, bool floating = true)
|
|
|
|
|
=> UIMessageTip.ShowOk(text, delay, floating);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 显示警告消息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="text">消息文本</param>
|
|
|
|
|
/// <param name="delay">消息停留时长(ms)。默认1秒</param>
|
|
|
|
|
/// <param name="floating">是否漂浮</param>
|
|
|
|
|
public void ShowWarningTip(string text, int delay = 1000, bool floating = true)
|
|
|
|
|
=> UIMessageTip.ShowWarning(text, delay, floating);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 显示出错消息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="text">消息文本</param>
|
|
|
|
|
/// <param name="delay">消息停留时长(ms)。默认1秒</param>
|
|
|
|
|
/// <param name="floating">是否漂浮</param>
|
|
|
|
|
public void ShowErrorTip(string text, int delay = 1000, bool floating = true)
|
|
|
|
|
=> UIMessageTip.ShowError(text, delay, floating);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 在指定控件附近显示消息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="controlOrItem">控件或工具栏项</param>
|
|
|
|
|
/// <param name="text">消息文本</param>
|
|
|
|
|
/// <param name="delay">消息停留时长(ms)。默认1秒</param>
|
|
|
|
|
/// <param name="floating">是否漂浮</param>
|
|
|
|
|
public void ShowInfoTip(Component controlOrItem, string text, int delay = 1000, bool floating = true)
|
|
|
|
|
=> UIMessageTip.Show(controlOrItem, text, null, delay, floating);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 在指定控件附近显示良好消息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="controlOrItem">控件或工具栏项</param>
|
|
|
|
|
/// <param name="text">消息文本</param>
|
|
|
|
|
/// <param name="delay">消息停留时长(ms)。默认1秒</param>
|
|
|
|
|
/// <param name="floating">是否漂浮</param>
|
|
|
|
|
public void ShowSuccessTip(Component controlOrItem, string text, int delay = 1000, bool floating = true)
|
|
|
|
|
=> UIMessageTip.ShowOk(controlOrItem, text, delay, floating);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 在指定控件附近显示出错消息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="controlOrItem">控件或工具栏项</param>
|
|
|
|
|
/// <param name="text">消息文本</param>
|
|
|
|
|
/// <param name="delay">消息停留时长(ms)。默认1秒</param>
|
|
|
|
|
/// <param name="floating">是否漂浮</param>
|
|
|
|
|
public void ShowErrorTip(Component controlOrItem, string text, int delay = 1000, bool floating = true)
|
|
|
|
|
=> UIMessageTip.ShowError(controlOrItem, text, delay, floating);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 在指定控件附近显示警告消息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="controlOrItem">控件或工具栏项</param>
|
|
|
|
|
/// <param name="text">消息文本</param>
|
|
|
|
|
/// <param name="delay">消息停留时长(ms)。默认1秒</param>
|
|
|
|
|
/// <param name="floating">是否漂浮</param>
|
|
|
|
|
public void ShowWarningTip(Component controlOrItem, string text, int delay = 1000, bool floating = true)
|
|
|
|
|
=> UIMessageTip.ShowWarning(controlOrItem, text, delay, floating, false);
|
|
|
|
|
|
|
|
|
|
public void ShowInfoNotifier(string desc, bool isDialog = false, int timeout = 2000)
|
|
|
|
|
{
|
2021-07-15 13:54:31 +08:00
|
|
|
|
UINotifierHelper.ShowNotifier(desc, UINotifierType.INFO, UILocalize.InfoTitle, isDialog, timeout);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ShowSuccessNotifier(string desc, bool isDialog = false, int timeout = 2000)
|
|
|
|
|
{
|
2021-07-15 13:54:31 +08:00
|
|
|
|
UINotifierHelper.ShowNotifier(desc, UINotifierType.OK, UILocalize.SuccessTitle, isDialog, timeout);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ShowWarningNotifier(string desc, bool isDialog = false, int timeout = 2000)
|
|
|
|
|
{
|
2021-07-15 13:54:31 +08:00
|
|
|
|
UINotifierHelper.ShowNotifier(desc, UINotifierType.WARNING, UILocalize.WarningTitle, isDialog, timeout);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ShowErrorNotifier(string desc, bool isDialog = false, int timeout = 2000)
|
|
|
|
|
{
|
2021-07-15 13:54:31 +08:00
|
|
|
|
UINotifierHelper.ShowNotifier(desc, UINotifierType.ERROR, UILocalize.ErrorTitle, isDialog, timeout);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-02 23:48:21 +08:00
|
|
|
|
public void ShowInfoNotifier(string desc, EventHandler clickEvent, int timeout = 2000)
|
|
|
|
|
{
|
|
|
|
|
UINotifierHelper.ShowNotifier(desc, clickEvent, UINotifierType.INFO, UILocalize.InfoTitle, timeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ShowSuccessNotifier(string desc, EventHandler clickEvent, int timeout = 2000)
|
|
|
|
|
{
|
|
|
|
|
UINotifierHelper.ShowNotifier(desc, clickEvent, UINotifierType.OK, UILocalize.SuccessTitle, timeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ShowWarningNotifier(string desc, EventHandler clickEvent, int timeout = 2000)
|
|
|
|
|
{
|
|
|
|
|
UINotifierHelper.ShowNotifier(desc, clickEvent, UINotifierType.WARNING, UILocalize.WarningTitle, timeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ShowErrorNotifier(string desc, EventHandler clickEvent, int timeout = 2000)
|
|
|
|
|
{
|
|
|
|
|
UINotifierHelper.ShowNotifier(desc, clickEvent, UINotifierType.ERROR, UILocalize.ErrorTitle, timeout);
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-17 23:46:56 +08:00
|
|
|
|
#endregion 一些辅助窗口
|
2020-05-11 21:11:29 +08:00
|
|
|
|
}
|
|
|
|
|
}
|