Exemplo n.º 1
0
        /// <summary>
        /// 外部调用接口
        /// </summary>
        /// <param name="text"></param>
        /// <param name="icon"></param>
        /// <param name="buttons"></param>
        /// <param name="defaultButton"></param>
        /// <returns></returns>
        public static DialogResult ShowConfirmForm(string text, ConfirmFormIcons icon, ConfirmFormButtons buttons, ConfirmFormDefaultButton defaultButton, int showMSeconds, Form owner)
        {
            ConfirmForm dialog = new ConfirmForm()
            {
                HintInfo      = text,
                HintIcon      = icon,
                Buttons       = buttons,
                DefaultButton = defaultButton,
                ShowMSeconds  = showMSeconds
            };

            if (owner != null && owner.IsHandleCreated && owner.Visible)
            {
                owner = FindTopParentForm(owner);
                return(dialog.ShowDialog(owner));
            }
            else
            {
                dialog.StartPosition = FormStartPosition.CenterScreen;
                return(dialog.ShowDialog());
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 显示确认框,showMSeconds = 0时表示不进行倒计时
 /// </summary>
 /// <param name="text"></param>
 /// <param name="icon"></param>
 /// <param name="buttons"></param>
 /// <param name="defaultButton"></param>
 /// <param name="showMSeconds"></param>
 /// <returns></returns>
 public static DialogResult ShowConfirmDialog(Form owner, string text, ConfirmFormIcons icon = ConfirmFormIcons.Hint,
                                              ConfirmFormButtons buttons             = ConfirmFormButtons.OK,
                                              ConfirmFormDefaultButton defaultButton = ConfirmFormDefaultButton.OK, int showMSeconds = 0)
 {
     return(ConfirmForm.ShowConfirmForm(text, icon, buttons, defaultButton, showMSeconds, owner));
 }