* UIFormHelper: 提问弹窗增加可默认是确认或者取消按钮的选择
This commit is contained in:
parent
c5251848cc
commit
ba4014f780
@ -1971,9 +1971,9 @@ namespace Sunny.UI
|
|||||||
/// <param name="msg">信息</param>
|
/// <param name="msg">信息</param>
|
||||||
/// <param name="showMask">显示遮罩层</param>
|
/// <param name="showMask">显示遮罩层</param>
|
||||||
/// <returns>结果</returns>
|
/// <returns>结果</returns>
|
||||||
public bool ShowAskDialog(string msg, bool showMask = false)
|
public bool ShowAskDialog(string msg, UIMessageDialogButtons defaultButton = UIMessageDialogButtons.Ok, bool showMask = false)
|
||||||
{
|
{
|
||||||
return UIMessageDialog.ShowMessageDialog(msg, UILocalize.AskTitle, true, UIStyle.Blue, showMask, true);
|
return UIMessageDialog.ShowMessageDialog(msg, UILocalize.AskTitle, true, UIStyle.Blue, showMask, true, defaultButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -2032,9 +2032,9 @@ namespace Sunny.UI
|
|||||||
/// <param name="style">主题</param>
|
/// <param name="style">主题</param>
|
||||||
/// <param name="showMask">显示遮罩层</param>
|
/// <param name="showMask">显示遮罩层</param>
|
||||||
/// <returns>结果</returns>
|
/// <returns>结果</returns>
|
||||||
public bool ShowAskDialog(string title, string msg, UIStyle style = UIStyle.Blue, bool showMask = false)
|
public bool ShowAskDialog(string title, string msg, UIMessageDialogButtons defaultButton = UIMessageDialogButtons.Ok, UIStyle style = UIStyle.Blue, bool showMask = false)
|
||||||
{
|
{
|
||||||
return UIMessageDialog.ShowMessageDialog(msg, title, true, style, showMask, true);
|
return UIMessageDialog.ShowMessageDialog(msg, title, true, style, showMask, true, defaultButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
* 2021-12-13: V3.0.9 增加全屏遮罩,Form的ShowDialogWithMask()扩展方法
|
* 2021-12-13: V3.0.9 增加全屏遮罩,Form的ShowDialogWithMask()扩展方法
|
||||||
* 2022-07-17: V3.2.1 解决ShowNotifier打开多个,全部关闭时出错的问题
|
* 2022-07-17: V3.2.1 解决ShowNotifier打开多个,全部关闭时出错的问题
|
||||||
* 2023-07-27: V3.4.1 默认提示弹窗TopMost为true
|
* 2023-07-27: V3.4.1 默认提示弹窗TopMost为true
|
||||||
|
* 2023-07-27: V3.4.1 提问弹窗增加可选择默认是确认或者取消按钮的选择
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -86,52 +87,7 @@ namespace Sunny.UI
|
|||||||
/// <param name="style">主题</param>
|
/// <param name="style">主题</param>
|
||||||
public static void ShowSuccessDialog(this Form form, string msg, UIStyle style = UIStyle.Green)
|
public static void ShowSuccessDialog(this Form form, string msg, UIStyle style = UIStyle.Green)
|
||||||
{
|
{
|
||||||
form.ShowMessageDialog(msg, UILocalize.SuccessTitle, false, style);
|
form.ShowSuccessDialog(UILocalize.SuccessTitle, msg, style);
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 信息提示框
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="form">窗体</param>
|
|
||||||
/// <param name="msg">信息</param>
|
|
||||||
/// <param name="style">主题</param>
|
|
||||||
public static void ShowInfoDialog(this Form form, string msg, UIStyle style = UIStyle.Gray)
|
|
||||||
{
|
|
||||||
form.ShowMessageDialog(msg, UILocalize.InfoTitle, false, style);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 警告信息提示框
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="form">窗体</param>
|
|
||||||
/// <param name="msg">信息</param>
|
|
||||||
/// <param name="style">主题</param>
|
|
||||||
public static void ShowWarningDialog(this Form form, string msg, UIStyle style = UIStyle.Orange)
|
|
||||||
{
|
|
||||||
form.ShowMessageDialog(msg, UILocalize.WarningTitle, false, style);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 错误信息提示框
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="form">窗体</param>
|
|
||||||
/// <param name="msg">信息</param>
|
|
||||||
/// <param name="style">主题</param>
|
|
||||||
public static void ShowErrorDialog(this Form form, string msg, UIStyle style = UIStyle.Red)
|
|
||||||
{
|
|
||||||
form.ShowMessageDialog(msg, UILocalize.ErrorTitle, false, style);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 确认信息提示框
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="form">窗体</param>
|
|
||||||
/// <param name="msg">信息</param>
|
|
||||||
/// <param name="style"></param>
|
|
||||||
/// <returns>结果</returns>
|
|
||||||
public static bool ShowAskDialog(this Form form, string msg, UIStyle style = UIStyle.Blue)
|
|
||||||
{
|
|
||||||
return form.ShowMessageDialog(msg, UILocalize.AskTitle, true, style);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -146,6 +102,17 @@ namespace Sunny.UI
|
|||||||
form.ShowMessageDialog(msg, title, false, style);
|
form.ShowMessageDialog(msg, title, false, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 信息提示框
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="form">窗体</param>
|
||||||
|
/// <param name="msg">信息</param>
|
||||||
|
/// <param name="style">主题</param>
|
||||||
|
public static void ShowInfoDialog(this Form form, string msg, UIStyle style = UIStyle.Gray)
|
||||||
|
{
|
||||||
|
form.ShowInfoDialog(UILocalize.InfoTitle, msg, style);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 信息提示框
|
/// 信息提示框
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -158,6 +125,17 @@ namespace Sunny.UI
|
|||||||
form.ShowMessageDialog(msg, title, false, style);
|
form.ShowMessageDialog(msg, title, false, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 警告信息提示框
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="form">窗体</param>
|
||||||
|
/// <param name="msg">信息</param>
|
||||||
|
/// <param name="style">主题</param>
|
||||||
|
public static void ShowWarningDialog(this Form form, string msg, UIStyle style = UIStyle.Orange)
|
||||||
|
{
|
||||||
|
form.ShowWarningDialog(UILocalize.WarningTitle, msg, style);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 警告信息提示框
|
/// 警告信息提示框
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -170,6 +148,17 @@ namespace Sunny.UI
|
|||||||
form.ShowMessageDialog(msg, title, false, style);
|
form.ShowMessageDialog(msg, title, false, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 错误信息提示框
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="form">窗体</param>
|
||||||
|
/// <param name="msg">信息</param>
|
||||||
|
/// <param name="style">主题</param>
|
||||||
|
public static void ShowErrorDialog(this Form form, string msg, UIStyle style = UIStyle.Red)
|
||||||
|
{
|
||||||
|
form.ShowErrorDialog(UILocalize.ErrorTitle, msg, style);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 错误信息提示框
|
/// 错误信息提示框
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -182,6 +171,18 @@ namespace Sunny.UI
|
|||||||
form.ShowMessageDialog(msg, title, false, style);
|
form.ShowMessageDialog(msg, title, false, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 确认信息提示框
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="form">窗体</param>
|
||||||
|
/// <param name="msg">信息</param>
|
||||||
|
/// <param name="style"></param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public static bool ShowAskDialog(this Form form, string msg, UIMessageDialogButtons defaultButton = UIMessageDialogButtons.Ok, UIStyle style = UIStyle.Blue)
|
||||||
|
{
|
||||||
|
return form.ShowAskDialog(UILocalize.AskTitle, msg, defaultButton, style);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 确认信息提示框
|
/// 确认信息提示框
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -190,7 +191,7 @@ namespace Sunny.UI
|
|||||||
/// <param name="msg">信息</param>
|
/// <param name="msg">信息</param>
|
||||||
/// <param name="style"></param>
|
/// <param name="style"></param>
|
||||||
/// <returns>结果</returns>
|
/// <returns>结果</returns>
|
||||||
public static bool ShowAskDialog(this Form form, string title, string msg, UIStyle style = UIStyle.Blue)
|
public static bool ShowAskDialog(this Form form, string title, string msg, UIMessageDialogButtons defaultButton = UIMessageDialogButtons.Ok, UIStyle style = UIStyle.Blue)
|
||||||
{
|
{
|
||||||
return form.ShowMessageDialog(msg, title, true, style);
|
return form.ShowMessageDialog(msg, title, true, style);
|
||||||
}
|
}
|
||||||
@ -216,11 +217,21 @@ namespace Sunny.UI
|
|||||||
/// <param name="showMask">显示遮罩层</param>
|
/// <param name="showMask">显示遮罩层</param>
|
||||||
/// <param name="topMost">置顶</param>
|
/// <param name="topMost">置顶</param>
|
||||||
/// <returns>结果</returns>
|
/// <returns>结果</returns>
|
||||||
public static bool ShowMessageDialog(string message, string title, bool showCancelButton, UIStyle style, bool showMask = true, bool topMost = true)
|
public static bool ShowMessageDialog(string message, string title, bool showCancelButton, UIStyle style, bool showMask = true, bool topMost = true, UIMessageDialogButtons defaultButton = UIMessageDialogButtons.Ok)
|
||||||
{
|
{
|
||||||
Point pt = SystemEx.GetCursorPos();
|
Point pt = SystemEx.GetCursorPos();
|
||||||
Rectangle screen = Screen.GetBounds(pt);
|
Rectangle screen = Screen.GetBounds(pt);
|
||||||
UIMessageForm frm = new UIMessageForm();
|
UIMessageForm frm = new UIMessageForm();
|
||||||
|
|
||||||
|
if (showCancelButton)
|
||||||
|
{
|
||||||
|
frm.DefaultButton = defaultButton;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
frm.DefaultButton = UIMessageDialogButtons.Ok;
|
||||||
|
}
|
||||||
|
|
||||||
frm.StartPosition = FormStartPosition.CenterScreen;
|
frm.StartPosition = FormStartPosition.CenterScreen;
|
||||||
frm.ShowMessage(message, title, showCancelButton, style);
|
frm.ShowMessage(message, title, showCancelButton, style);
|
||||||
frm.ShowInTaskbar = false;
|
frm.ShowInTaskbar = false;
|
||||||
@ -237,6 +248,12 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum UIMessageDialogButtons
|
||||||
|
{
|
||||||
|
Ok,
|
||||||
|
Cancel
|
||||||
|
}
|
||||||
|
|
||||||
public static class UIMessageBox
|
public static class UIMessageBox
|
||||||
{
|
{
|
||||||
public static void Show(string text, bool showMask = true, bool topMost = true)
|
public static void Show(string text, bool showMask = true, bool topMost = true)
|
||||||
|
131
SunnyUI/Forms/UIMessageForm.Designer.cs
generated
131
SunnyUI/Forms/UIMessageForm.Designer.cs
generated
@ -28,85 +28,82 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.btnCancel = new Sunny.UI.UIButton();
|
btnCancel = new UIButton();
|
||||||
this.btnOK = new Sunny.UI.UIButton();
|
btnOK = new UIButton();
|
||||||
this.lbMsg = new Sunny.UI.UIRichTextBox();
|
lbMsg = new UIRichTextBox();
|
||||||
this.SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// btnCancel
|
// btnCancel
|
||||||
//
|
//
|
||||||
this.btnCancel.BackColor = System.Drawing.Color.Transparent;
|
btnCancel.BackColor = System.Drawing.Color.Transparent;
|
||||||
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
|
btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 12F);
|
btnCancel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
this.btnCancel.Location = new System.Drawing.Point(224, 220);
|
btnCancel.Location = new System.Drawing.Point(224, 220);
|
||||||
this.btnCancel.Margin = new System.Windows.Forms.Padding(0);
|
btnCancel.Margin = new System.Windows.Forms.Padding(0);
|
||||||
this.btnCancel.MinimumSize = new System.Drawing.Size(1, 1);
|
btnCancel.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.btnCancel.Name = "btnCancel";
|
btnCancel.Name = "btnCancel";
|
||||||
this.btnCancel.Size = new System.Drawing.Size(224, 48);
|
btnCancel.Size = new System.Drawing.Size(224, 48);
|
||||||
this.btnCancel.TabIndex = 6;
|
btnCancel.TabIndex = 6;
|
||||||
this.btnCancel.Text = "取消";
|
btnCancel.Text = "取消";
|
||||||
this.btnCancel.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
btnCancel.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
this.btnCancel.TipsText = null;
|
btnCancel.TipsText = null;
|
||||||
this.btnCancel.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
|
btnCancel.Click += btnCancel_Click;
|
||||||
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
btnCancel.MouseEnter += btnOK_MouseEnter;
|
||||||
this.btnCancel.MouseEnter += new System.EventHandler(this.btnOK_MouseEnter);
|
btnCancel.MouseLeave += btnOK_MouseLeave;
|
||||||
this.btnCancel.MouseLeave += new System.EventHandler(this.btnOK_MouseLeave);
|
|
||||||
//
|
//
|
||||||
// btnOK
|
// btnOK
|
||||||
//
|
//
|
||||||
this.btnOK.BackColor = System.Drawing.Color.Transparent;
|
btnOK.BackColor = System.Drawing.Color.Transparent;
|
||||||
this.btnOK.Cursor = System.Windows.Forms.Cursors.Hand;
|
btnOK.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.btnOK.Font = new System.Drawing.Font("微软雅黑", 12F);
|
btnOK.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
this.btnOK.Location = new System.Drawing.Point(2, 220);
|
btnOK.Location = new System.Drawing.Point(2, 220);
|
||||||
this.btnOK.Margin = new System.Windows.Forms.Padding(0);
|
btnOK.Margin = new System.Windows.Forms.Padding(0);
|
||||||
this.btnOK.MinimumSize = new System.Drawing.Size(1, 1);
|
btnOK.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.btnOK.Name = "btnOK";
|
btnOK.Name = "btnOK";
|
||||||
this.btnOK.Size = new System.Drawing.Size(223, 48);
|
btnOK.Size = new System.Drawing.Size(223, 48);
|
||||||
this.btnOK.TabIndex = 5;
|
btnOK.TabIndex = 5;
|
||||||
this.btnOK.Text = "确定";
|
btnOK.Text = "确定";
|
||||||
this.btnOK.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
btnOK.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
this.btnOK.TipsText = null;
|
btnOK.TipsText = null;
|
||||||
this.btnOK.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
|
btnOK.Click += btnOK_Click;
|
||||||
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
|
btnOK.MouseEnter += btnOK_MouseEnter;
|
||||||
this.btnOK.MouseEnter += new System.EventHandler(this.btnOK_MouseEnter);
|
btnOK.MouseLeave += btnOK_MouseLeave;
|
||||||
this.btnOK.MouseLeave += new System.EventHandler(this.btnOK_MouseLeave);
|
|
||||||
//
|
//
|
||||||
// lbMsg
|
// lbMsg
|
||||||
//
|
//
|
||||||
this.lbMsg.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
lbMsg.BackColor = System.Drawing.Color.FromArgb(235, 243, 255);
|
||||||
this.lbMsg.FillColor = System.Drawing.Color.White;
|
lbMsg.FillColor = System.Drawing.Color.White;
|
||||||
this.lbMsg.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
lbMsg.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
this.lbMsg.Location = new System.Drawing.Point(14, 50);
|
lbMsg.Location = new System.Drawing.Point(14, 50);
|
||||||
this.lbMsg.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
lbMsg.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||||
this.lbMsg.MinimumSize = new System.Drawing.Size(1, 1);
|
lbMsg.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.lbMsg.Name = "lbMsg";
|
lbMsg.Name = "lbMsg";
|
||||||
this.lbMsg.Padding = new System.Windows.Forms.Padding(2);
|
lbMsg.Padding = new System.Windows.Forms.Padding(2);
|
||||||
this.lbMsg.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
|
lbMsg.RadiusSides = UICornerRadiusSides.None;
|
||||||
this.lbMsg.ReadOnly = true;
|
lbMsg.ReadOnly = true;
|
||||||
this.lbMsg.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
|
lbMsg.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
|
||||||
this.lbMsg.ShowText = false;
|
lbMsg.ShowText = false;
|
||||||
this.lbMsg.Size = new System.Drawing.Size(422, 158);
|
lbMsg.Size = new System.Drawing.Size(422, 158);
|
||||||
this.lbMsg.TabIndex = 7;
|
lbMsg.TabIndex = 7;
|
||||||
this.lbMsg.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
|
lbMsg.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
this.lbMsg.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
|
|
||||||
//
|
//
|
||||||
// UIMessageForm
|
// UIMessageForm
|
||||||
//
|
//
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||||
this.ClientSize = new System.Drawing.Size(450, 270);
|
ClientSize = new System.Drawing.Size(450, 270);
|
||||||
this.Controls.Add(this.lbMsg);
|
Controls.Add(lbMsg);
|
||||||
this.Controls.Add(this.btnCancel);
|
Controls.Add(btnCancel);
|
||||||
this.Controls.Add(this.btnOK);
|
Controls.Add(btnOK);
|
||||||
this.EscClose = true;
|
EscClose = true;
|
||||||
this.MaximizeBox = false;
|
MaximizeBox = false;
|
||||||
this.MinimizeBox = false;
|
MinimizeBox = false;
|
||||||
this.Name = "UIMessageForm";
|
Name = "UIMessageForm";
|
||||||
this.Padding = new System.Windows.Forms.Padding(1, 35, 1, 3);
|
Padding = new System.Windows.Forms.Padding(1, 35, 1, 3);
|
||||||
this.ShowInTaskbar = false;
|
ShowInTaskbar = false;
|
||||||
this.Text = "UIMsgBox";
|
Text = "UIMsgBox";
|
||||||
this.ZoomScaleRect = new System.Drawing.Rectangle(15, 15, 450, 270);
|
ZoomScaleRect = new System.Drawing.Rectangle(15, 15, 450, 270);
|
||||||
this.ResumeLayout(false);
|
Shown += UIMessageForm_Shown;
|
||||||
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -100,7 +100,10 @@ namespace Sunny.UI
|
|||||||
protected override void DoEnter()
|
protected override void DoEnter()
|
||||||
{
|
{
|
||||||
base.DoEnter();
|
base.DoEnter();
|
||||||
btnOK_Click(null, null);
|
if (!ShowCancel)
|
||||||
|
{
|
||||||
|
btnOK_Click(null, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnOK_Click(object sender, EventArgs e)
|
private void btnOK_Click(object sender, EventArgs e)
|
||||||
@ -125,13 +128,6 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
base.SetStyleColor(uiColor);
|
base.SetStyleColor(uiColor);
|
||||||
|
|
||||||
if (btnOK != null)
|
|
||||||
{
|
|
||||||
btnOK.FillColor = BackColor;
|
|
||||||
btnOK.RectColor = Color.FromArgb(36, uiColor.ButtonRectColor);
|
|
||||||
btnOK.ForeColor = uiColor.LabelForeColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (btnCancel != null)
|
if (btnCancel != null)
|
||||||
{
|
{
|
||||||
btnCancel.FillColor = BackColor;
|
btnCancel.FillColor = BackColor;
|
||||||
@ -139,6 +135,13 @@ namespace Sunny.UI
|
|||||||
btnCancel.ForeColor = uiColor.LabelForeColor;
|
btnCancel.ForeColor = uiColor.LabelForeColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (btnOK != null)
|
||||||
|
{
|
||||||
|
btnOK.FillColor = BackColor;
|
||||||
|
btnOK.RectColor = Color.FromArgb(36, uiColor.ButtonRectColor);
|
||||||
|
btnOK.ForeColor = uiColor.LabelForeColor;
|
||||||
|
}
|
||||||
|
|
||||||
if (lbMsg != null)
|
if (lbMsg != null)
|
||||||
{
|
{
|
||||||
lbMsg.ForeColor = uiColor.LabelForeColor;
|
lbMsg.ForeColor = uiColor.LabelForeColor;
|
||||||
@ -149,6 +152,8 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UIMessageDialogButtons DefaultButton { get; set; } = UIMessageDialogButtons.Ok;
|
||||||
|
|
||||||
private void btnOK_MouseEnter(object sender, EventArgs e)
|
private void btnOK_MouseEnter(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//((UIButton)sender).RadiusSides = UICornerRadiusSides.All;
|
//((UIButton)sender).RadiusSides = UICornerRadiusSides.All;
|
||||||
@ -175,5 +180,17 @@ namespace Sunny.UI
|
|||||||
//btnOK.ShowFocusLine = btnCancel.ShowFocusLine = showCancel;
|
//btnOK.ShowFocusLine = btnCancel.ShowFocusLine = showCancel;
|
||||||
btnOK.ShowFocusColor = btnCancel.ShowFocusColor = showCancel;
|
btnOK.ShowFocusColor = btnCancel.ShowFocusColor = showCancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UIMessageForm_Shown(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!ShowCancel || DefaultButton == UIMessageDialogButtons.Ok)
|
||||||
|
{
|
||||||
|
btnOK.Focus();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
btnCancel.Focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,24 +1,24 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
The primary goals of this format is to allow a simple XML format
|
||||||
that is mostly human readable. The generation and parsing of the
|
that is mostly human readable. The generation and parsing of the
|
||||||
various data types are done through the TypeConverter classes
|
various data types are done through the TypeConverter classes
|
||||||
associated with the data types.
|
associated with the data types.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
... ado.net/XML headers & schema ...
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
<resheader name="version">2.0</resheader>
|
<resheader name="version">2.0</resheader>
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
</data>
|
</data>
|
||||||
@ -26,36 +26,36 @@
|
|||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
<comment>This is a comment</comment>
|
<comment>This is a comment</comment>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
There are any number of "resheader" rows that contain simple
|
||||||
name/value pairs.
|
name/value pairs.
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
Each data row contains a name, and value. The row also contains a
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
text/value conversion through the TypeConverter architecture.
|
text/value conversion through the TypeConverter architecture.
|
||||||
Classes that don't support this are serialized and stored with the
|
Classes that don't support this are serialized and stored with the
|
||||||
mimetype set.
|
mimetype set.
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
The mimetype is used for serialized objects, and tells the
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
read any of the formats listed below.
|
read any of the formats listed below.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
value : The object must be serialized into a byte array
|
value : The object must be serialized into a byte array
|
||||||
: using a System.ComponentModel.TypeConverter
|
: using a System.ComponentModel.TypeConverter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
-->
|
-->
|
||||||
|
@ -1233,9 +1233,9 @@ namespace Sunny.UI
|
|||||||
/// <param name="msg">信息</param>
|
/// <param name="msg">信息</param>
|
||||||
/// <param name="showMask">显示遮罩层</param>
|
/// <param name="showMask">显示遮罩层</param>
|
||||||
/// <returns>结果</returns>
|
/// <returns>结果</returns>
|
||||||
public bool ShowAskDialog(string msg, bool showMask = false)
|
public bool ShowAskDialog(string msg, UIMessageDialogButtons defaultButton = UIMessageDialogButtons.Ok, bool showMask = false)
|
||||||
{
|
{
|
||||||
return UIMessageDialog.ShowMessageDialog(msg, UILocalize.AskTitle, true, UIStyle.Blue, showMask, true);
|
return UIMessageDialog.ShowMessageDialog(msg, UILocalize.AskTitle, true, UIStyle.Blue, showMask, true, defaultButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -1294,9 +1294,9 @@ namespace Sunny.UI
|
|||||||
/// <param name="style">主题</param>
|
/// <param name="style">主题</param>
|
||||||
/// <param name="showMask">显示遮罩层</param>
|
/// <param name="showMask">显示遮罩层</param>
|
||||||
/// <returns>结果</returns>
|
/// <returns>结果</returns>
|
||||||
public bool ShowAskDialog(string title, string msg, UIStyle style = UIStyle.Blue, bool showMask = false)
|
public bool ShowAskDialog(string title, string msg, UIMessageDialogButtons defaultButton = UIMessageDialogButtons.Ok, UIStyle style = UIStyle.Blue, bool showMask = false)
|
||||||
{
|
{
|
||||||
return UIMessageDialog.ShowMessageDialog(msg, title, true, style, showMask, true);
|
return UIMessageDialog.ShowMessageDialog(msg, title, true, style, showMask, true, defaultButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user