Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        private static bool ShowMessageDialog(string message, string title, bool isShowCancel, UIStyle style)
        {
            UIMessageForm frm = new UIMessageForm();

            frm.ShowMessage(message, title, isShowCancel, style);
            frm.ShowDialog();
            bool isOk = frm.IsOK;

            frm.Dispose();
            return(isOk);
        }
Ejemplo n.º 4
0
        public static bool ShowMessageDialog(this Form form, string message, string title, bool isShowCancel, UIStyle style)
        {
            UIMessageForm frm = new UIMessageForm();

            frm.TopMost = form != null && form.TopMost;
            frm.ShowMessage(message, title, isShowCancel, style);
            frm.ShowDialog();
            bool isOk = frm.IsOK;

            frm.Dispose();
            return(isOk);
        }