* UIPage: 增加PageDeselecting,取消页面选择时增加判断
This commit is contained in:
parent
d448cc9cc0
commit
90b7b4b92b
@ -43,7 +43,7 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 控件缩放前在其容器里的位置
|
/// 控件缩放前在其容器里的位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Browsable(false)]
|
[Browsable(false), DefaultValue(typeof(Rectangle), "0, 0, 0, 0")]
|
||||||
public Rectangle ZoomScaleRect { get; set; }
|
public Rectangle ZoomScaleRect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -21,7 +21,7 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 控件缩放前在其容器里的位置
|
/// 控件缩放前在其容器里的位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Browsable(false)]
|
[Browsable(false), DefaultValue(typeof(Rectangle), "0, 0, 0, 0")]
|
||||||
public Rectangle ZoomScaleRect { get; set; }
|
public Rectangle ZoomScaleRect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -51,7 +51,7 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 控件缩放前在其容器里的位置
|
/// 控件缩放前在其容器里的位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Browsable(false)]
|
[Browsable(false), DefaultValue(typeof(Rectangle), "0, 0, 0, 0")]
|
||||||
public Rectangle ZoomScaleRect { get; set; }
|
public Rectangle ZoomScaleRect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -63,7 +63,7 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 控件缩放前在其容器里的位置
|
/// 控件缩放前在其容器里的位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Browsable(false)]
|
[Browsable(false), DefaultValue(typeof(Rectangle), "0, 0, 0, 0")]
|
||||||
public Rectangle ZoomScaleRect { get; set; }
|
public Rectangle ZoomScaleRect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -151,7 +151,7 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 控件缩放前在其容器里的位置
|
/// 控件缩放前在其容器里的位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Browsable(false)]
|
[Browsable(false), DefaultValue(typeof(Rectangle), "0, 0, 0, 0")]
|
||||||
public Rectangle ZoomScaleRect { get; set; }
|
public Rectangle ZoomScaleRect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -53,7 +53,7 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 控件缩放前在其容器里的位置
|
/// 控件缩放前在其容器里的位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Browsable(false)]
|
[Browsable(false), DefaultValue(typeof(Rectangle), "0, 0, 0, 0")]
|
||||||
public Rectangle ZoomScaleRect { get; set; }
|
public Rectangle ZoomScaleRect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1394,7 +1394,7 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 控件缩放前在其容器里的位置
|
/// 控件缩放前在其容器里的位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Browsable(false)]
|
[Browsable(false), DefaultValue(typeof(Rectangle), "0, 0, 0, 0")]
|
||||||
public Rectangle ZoomScaleRect { get; set; }
|
public Rectangle ZoomScaleRect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -51,7 +51,7 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 控件缩放前在其容器里的位置
|
/// 控件缩放前在其容器里的位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Browsable(false)]
|
[Browsable(false), DefaultValue(typeof(Rectangle), "0, 0, 0, 0")]
|
||||||
public Rectangle ZoomScaleRect { get; set; }
|
public Rectangle ZoomScaleRect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -201,7 +201,7 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 控件缩放前在其容器里的位置
|
/// 控件缩放前在其容器里的位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Browsable(false)]
|
[Browsable(false), DefaultValue(typeof(Rectangle), "0, 0, 0, 0")]
|
||||||
public Rectangle ZoomScaleRect { get; set; }
|
public Rectangle ZoomScaleRect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -53,7 +53,7 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 控件缩放前在其容器里的位置
|
/// 控件缩放前在其容器里的位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Browsable(false)]
|
[Browsable(false), DefaultValue(typeof(Rectangle), "0, 0, 0, 0")]
|
||||||
public Rectangle ZoomScaleRect { get; set; }
|
public Rectangle ZoomScaleRect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -75,7 +75,7 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 控件缩放前在其容器里的位置
|
/// 控件缩放前在其容器里的位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Browsable(false)]
|
[Browsable(false), DefaultValue(typeof(Rectangle), "0, 0, 0, 0")]
|
||||||
public Rectangle ZoomScaleRect { get; set; }
|
public Rectangle ZoomScaleRect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -130,7 +130,7 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 控件缩放前在其容器里的位置
|
/// 控件缩放前在其容器里的位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Browsable(false)]
|
[Browsable(false), DefaultValue(typeof(Rectangle), "0, 0, 0, 0")]
|
||||||
public Rectangle ZoomScaleRect { get; set; }
|
public Rectangle ZoomScaleRect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -358,6 +358,13 @@ namespace Sunny.UI
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<UIPage> pages = tabControl.SelectedTab.GetControls<UIPage>();
|
||||||
|
if (pages.Count == 1)
|
||||||
|
{
|
||||||
|
bool isCancel = pages[0].OnPageDeselecting();
|
||||||
|
if (isCancel) return false;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var item in PageItems)
|
foreach (var item in PageItems)
|
||||||
{
|
{
|
||||||
if (item.Value.PageIndex == pageIndex && item.Key != null)
|
if (item.Value.PageIndex == pageIndex && item.Key != null)
|
||||||
@ -380,6 +387,13 @@ namespace Sunny.UI
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<UIPage> pages = tabControl.SelectedTab.GetControls<UIPage>();
|
||||||
|
if (pages.Count == 1)
|
||||||
|
{
|
||||||
|
bool isCancel = pages[0].OnPageDeselecting();
|
||||||
|
if (isCancel) return false;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var item in PageItems)
|
foreach (var item in PageItems)
|
||||||
{
|
{
|
||||||
if (item.Value.PageGuid == guid && item.Key != null)
|
if (item.Value.PageGuid == guid && item.Key != null)
|
||||||
|
@ -57,7 +57,7 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 控件缩放前在其容器里的位置
|
/// 控件缩放前在其容器里的位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Browsable(false)]
|
[Browsable(false), DefaultValue(typeof(Rectangle), "0, 0, 0, 0")]
|
||||||
public Rectangle ZoomScaleRect { get; set; }
|
public Rectangle ZoomScaleRect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -91,7 +91,7 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 控件缩放前在其容器里的位置
|
/// 控件缩放前在其容器里的位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Browsable(false)]
|
[Browsable(false), DefaultValue(typeof(Rectangle), "0, 0, 0, 0")]
|
||||||
public Rectangle ZoomScaleRect { get; set; }
|
public Rectangle ZoomScaleRect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -77,7 +77,7 @@ namespace Sunny.UI
|
|||||||
_fillColor = UIStyles.Blue.TabControlBackColor;
|
_fillColor = UIStyles.Blue.TabControlBackColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Browsable(false)]
|
[Browsable(false), DefaultValue(null)]
|
||||||
public IFrame Frame
|
public IFrame Frame
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
@ -92,7 +92,7 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 控件缩放前在其容器里的位置
|
/// 控件缩放前在其容器里的位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Browsable(false)]
|
[Browsable(false), DefaultValue(typeof(Rectangle), "0, 0, 0, 0")]
|
||||||
public Rectangle ZoomScaleRect { get; set; }
|
public Rectangle ZoomScaleRect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -71,7 +71,7 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 控件缩放前在其容器里的位置
|
/// 控件缩放前在其容器里的位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Browsable(false)]
|
[Browsable(false), DefaultValue(typeof(Rectangle), "0, 0, 0, 0")]
|
||||||
public Rectangle ZoomScaleRect { get; set; }
|
public Rectangle ZoomScaleRect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -62,7 +62,7 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 控件缩放前在其容器里的位置
|
/// 控件缩放前在其容器里的位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Browsable(false)]
|
[Browsable(false), DefaultValue(typeof(Rectangle), "0, 0, 0, 0")]
|
||||||
public Rectangle ZoomScaleRect { get; set; }
|
public Rectangle ZoomScaleRect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -53,7 +53,7 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 控件缩放前在其容器里的位置
|
/// 控件缩放前在其容器里的位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Browsable(false)]
|
[Browsable(false), DefaultValue(typeof(Rectangle), "0, 0, 0, 0")]
|
||||||
public Rectangle ZoomScaleRect { get; set; }
|
public Rectangle ZoomScaleRect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -173,7 +173,7 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 控件缩放前在其容器里的位置
|
/// 控件缩放前在其容器里的位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Browsable(false)]
|
[Browsable(false), DefaultValue(typeof(Rectangle), "0, 0, 0, 0")]
|
||||||
public Rectangle ZoomScaleRect { get; set; }
|
public Rectangle ZoomScaleRect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
@ -50,6 +51,20 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class PageDeselectingEventArgs : CancelEventArgs
|
||||||
|
{
|
||||||
|
private string _cancelReason;
|
||||||
|
|
||||||
|
public PageDeselectingEventArgs(bool cancel, string cancelReason) : base(cancel)
|
||||||
|
{
|
||||||
|
_cancelReason = cancelReason;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string CancelReason => _cancelReason;
|
||||||
|
}
|
||||||
|
|
||||||
|
public delegate void PageDeselectingEventHandler(object sender, PageDeselectingEventArgs e);
|
||||||
|
|
||||||
public delegate void OnUIPageChanged(object sender, UIPageEventArgs e);
|
public delegate void OnUIPageChanged(object sender, UIPageEventArgs e);
|
||||||
|
|
||||||
public static class UIMessageDialog
|
public static class UIMessageDialog
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
* 2022-08-25: V3.2.3 重构多页面框架传值:页面发送给框架 SendParamToPage 函数
|
* 2022-08-25: V3.2.3 重构多页面框架传值:页面发送给框架 SendParamToPage 函数
|
||||||
* 2022-08-25: V3.2.3 重构多页面框架传值:接收框架、页面传值 ReceiveParams 事件
|
* 2022-08-25: V3.2.3 重构多页面框架传值:接收框架、页面传值 ReceiveParams 事件
|
||||||
* 2022-10-28: V3.2.6 标题栏增加扩展按钮
|
* 2022-10-28: V3.2.6 标题栏增加扩展按钮
|
||||||
|
* 2023-02-24: V3.3.2 增加PageDeselecting,取消页面选择时增加判断
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -107,6 +108,15 @@ namespace Sunny.UI
|
|||||||
base.SizeGripStyle = SizeGripStyle.Hide;
|
base.SizeGripStyle = SizeGripStyle.Hide;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public event PageDeselectingEventHandler PageDeselecting;
|
||||||
|
|
||||||
|
internal bool OnPageDeselecting()
|
||||||
|
{
|
||||||
|
PageDeselectingEventArgs e = new PageDeselectingEventArgs(false, string.Empty);
|
||||||
|
PageDeselecting?.Invoke(this, e);
|
||||||
|
return e.Cancel;
|
||||||
|
}
|
||||||
|
|
||||||
[Browsable(false)]
|
[Browsable(false)]
|
||||||
public new IButtonControl AcceptButton
|
public new IButtonControl AcceptButton
|
||||||
{
|
{
|
||||||
@ -235,7 +245,7 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 控件缩放前在其容器里的位置
|
/// 控件缩放前在其容器里的位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Browsable(false)]
|
[Browsable(false), DefaultValue(typeof(Rectangle), "0, 0, 0, 0")]
|
||||||
public Rectangle ZoomScaleRect { get; set; }
|
public Rectangle ZoomScaleRect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user