예제 #1
0
 public static TaskButton Show(
     IWin32Window owner,
     Icon formIcon,
     string formTitle,
     Image taskImage,
     bool scaleTaskImageWithDpi,
     string introText,
     TaskButton[] taskButtons,
     TaskButton acceptTaskButton,
     TaskButton cancelTaskButton,
     int pixelWidth96Dpi)
 {
     return(Show(owner, formIcon, formTitle, taskImage, scaleTaskImageWithDpi, introText,
                 taskButtons, acceptTaskButton, cancelTaskButton, pixelWidth96Dpi, null, null));
 }
예제 #2
0
        public static TaskButton Show(
            IWin32Window owner,
            Icon formIcon,
            string formTitle,
            Image taskImage,
            bool scaleTaskImageWithDpi,
            string introText,
            TaskButton[] taskButtons,
            TaskButton acceptTaskButton,
            TaskButton cancelTaskButton,
            int pixelWidth96Dpi,
            string auxButtonText,
            EventHandler auxButtonClickHandler)
        {
            using (TaskDialogForm form = new TaskDialogForm())
            {
                form.Icon                  = formIcon;
                form.IntroText             = introText;
                form.Text                  = formTitle;
                form.TaskImage             = taskImage;
                form.ScaleTaskImageWithDpi = scaleTaskImageWithDpi;
                form.TaskButtons           = taskButtons;
                form.AcceptTaskButton      = acceptTaskButton;
                form.CancelTaskButton      = cancelTaskButton;

                if (auxButtonText != null)
                {
                    form.AuxButtonText = auxButtonText;
                }

                if (auxButtonClickHandler != null)
                {
                    form.AuxButtonClick += auxButtonClickHandler;
                }

                int pixelWidth = UI.ScaleWidth(pixelWidth96Dpi);
                form.ClientSize = new Size(pixelWidth, form.ClientSize.Height);

                DialogResult dr     = form.ShowDialog(owner);
                TaskButton   result = form.DialogResult;

                return(result);
            }
        }