Пример #1
0
        public bool?ShowDialog()
        {
            this._dialogInvoked = false;
            Win32PrintDialog win32PrintDialog = new Win32PrintDialog();

            win32PrintDialog.PrintTicket          = this._printTicket;
            win32PrintDialog.PrintQueue           = this._printQueue;
            win32PrintDialog.MinPage              = Math.Max(1U, Math.Min(this._minPage, this._maxPage));
            win32PrintDialog.MaxPage              = Math.Max(win32PrintDialog.MinPage, Math.Max(this._minPage, this._maxPage));
            win32PrintDialog.PageRangeEnabled     = this._userPageRangeEnabled;
            win32PrintDialog.SelectedPagesEnabled = this._selectedPagesEnabled;
            win32PrintDialog.CurrentPageEnabled   = this._currentPageEnabled;
            win32PrintDialog.PageRange            = new PageRange(Math.Max((int)win32PrintDialog.MinPage, this._pageRange.PageFrom), Math.Min((int)win32PrintDialog.MaxPage, this._pageRange.PageTo));
            win32PrintDialog.PageRangeSelection   = this._pageRangeSelection;
            uint num = win32PrintDialog.ShowDialog();

            if (num == 2U || num == 1U)
            {
                this._printTicket        = win32PrintDialog.PrintTicket;
                this._printQueue         = win32PrintDialog.PrintQueue;
                this._pageRange          = win32PrintDialog.PageRange;
                this._pageRangeSelection = win32PrintDialog.PageRangeSelection;
                this._dialogInvoked      = true;
            }
            return(new bool?(num == 1U));
        }
Пример #2
0
        ShowDialog()
        {
            //
            // Reset this flag as we have not displayed the dialog yet.
            //
            _dialogInvoked = false;

            Win32PrintDialog dlg = new Win32PrintDialog();

            //
            // Setup the old values if any exist.
            //
            dlg.PrintTicket          = _printTicket;
            dlg.PrintQueue           = _printQueue;
            dlg.MinPage              = Math.Max(1, Math.Min(_minPage, _maxPage));
            dlg.MaxPage              = Math.Max(dlg.MinPage, Math.Max(_minPage, _maxPage));
            dlg.PageRangeEnabled     = _userPageRangeEnabled;
            dlg.SelectedPagesEnabled = _selectedPagesEnabled;
            dlg.CurrentPageEnabled   = _currentPageEnabled;

            dlg.PageRange = new PageRange(
                Math.Max((int)dlg.MinPage, _pageRange.PageFrom),
                Math.Min((int)dlg.MaxPage, _pageRange.PageTo));
            dlg.PageRangeSelection = _pageRangeSelection;

            //
            // Invoke the Win32 dialog
            //
            UInt32 dialogResult = dlg.ShowDialog();

            if ((dialogResult == MS.Internal.Printing.NativeMethods.PD_RESULT_APPLY) ||
                (dialogResult == MS.Internal.Printing.NativeMethods.PD_RESULT_PRINT))
            {
                _printTicket        = dlg.PrintTicket;
                _printQueue         = dlg.PrintQueue;
                _pageRange          = dlg.PageRange;
                _pageRangeSelection = dlg.PageRangeSelection;
                _dialogInvoked      = true;
            }

            return(dialogResult == MS.Internal.Printing.NativeMethods.PD_RESULT_PRINT);
        }