/// <summary> /// 确认信息提示框 /// </summary> /// <param name="title">标题</param> /// <param name="message">信息</param> /// <param name="showCancelButton">显示取消按钮</param> /// <param name="style">主题</param> /// <param name="showMask">显示遮罩层</param> /// <param name="topMost">置顶</param> /// <returns>结果</returns> public static bool ShowMessageDialog(string message, string title, bool showCancelButton, UIStyle style, bool showMask = true, bool topMost = false) { Point pt = SystemEx.GetCursorPos(); Rectangle screen = Screen.GetBounds(pt); Form mask = null; if (showMask) { mask = new Form(); mask.FormBorderStyle = FormBorderStyle.None; mask.BackColor = Color.FromArgb(0, 0, 0); mask.Opacity = 0.5; mask.ShowInTaskbar = false; mask.StartPosition = FormStartPosition.Manual; mask.Bounds = screen; mask.Show(); mask.TopMost = true; Application.DoEvents(); } UIMessageForm frm = new UIMessageForm(); frm.StartPosition = FormStartPosition.CenterScreen; frm.ShowMessage(message, title, showCancelButton, style); frm.ShowInTaskbar = false; frm.TopMost = showMask || topMost; frm.ShowDialog(); bool isOk = frm.IsOK; frm.Dispose(); mask?.Close(); return(isOk); }
/// <summary> /// 确认信息提示框 /// </summary> /// <param name="title">标题</param> /// <param name="message">信息</param> /// <param name="showCancelButton">显示取消按钮</param> /// <param name="style">主题</param> /// <param name="showMask">显示遮罩层</param> /// <param name="topMost">置顶</param> /// <returns>结果</returns> public static bool ShowMessageDialog(string message, string title, bool showCancelButton, UIStyle style, bool showMask = true, bool topMost = false) { Point pt = SystemEx.GetCursorPos(); Rectangle screen = Screen.GetBounds(pt); UIMessageForm frm = new UIMessageForm(); frm.StartPosition = FormStartPosition.CenterScreen; frm.ShowMessage(message, title, showCancelButton, style); frm.ShowInTaskbar = false; frm.TopMost = topMost; if (showMask) { frm.ShowDialogWithMask(); } else { frm.ShowDialog(); } bool isOk = frm.IsOK; frm.Dispose(); return(isOk); }
public static Form ShowFullMask(this Form form) { Point pt = SystemEx.GetCursorPos(); Rectangle screen = Screen.GetBounds(pt); Form mask = new Form(); mask.FormBorderStyle = FormBorderStyle.None; mask.BackColor = Color.FromArgb(0, 0, 0); mask.Opacity = 0.5; mask.ShowInTaskbar = false; mask.StartPosition = FormStartPosition.Manual; mask.Bounds = screen; mask.TopMost = true; mask.Show(); return(mask); }
public static DialogResult ShowDialogWithMask(this Form form) { Point pt = SystemEx.GetCursorPos(); Rectangle screen = Screen.GetBounds(pt); FMask mask = new FMask(); mask.Bounds = screen; mask.Show(); form.ShowInTaskbar = false; form.TopMost = true; DialogResult dr = form.ShowDialog(); mask.Dispose(); return(dr); }