// shows PrintOptionsDialog and prints selected style if user clicks Ok button private void InternalPrint() { // setup print context PrintContextType context = PrintContextType.DateRange; if (_schedule.SelectedAppointment != null) { context |= PrintContextType.Appointment; } // show PrintOptionsDialog PrintOptionsDialog form = new PrintOptionsDialog(this, CurrentStyle, context); form.StartDate = _schedule.VisibleDates[0]; form.EndDate = _schedule.VisibleDates[_schedule.VisibleDates.Count - 1]; bool?result = form.ShowDialog(); if (result.HasValue && result.Value) { // user clicks Ok // set PrintStyle properties according to user settings in a dialog CurrentStyle = form.SelectedStyle; HidePrivateAppointments = form.HidePrivateAppointments; SetupPrintContext(CurrentStyle, form.StartDate, form.EndDate); // print the document PrintDocument.Print(new System.Drawing.Printing.PrinterSettings()); _currentAppointments = null; } }
// shows PrintOptionsDialog and prints selected style if user clicks Ok button private void InternalPrint() { // setup print context PrintContextType context = PrintContextType.DateRange; if (_schedule.SelectedAppointment != null) { context |= PrintContextType.Appointment; } // show PrintOptionsDialog PrintOptionsDialog form = new PrintOptionsDialog(this, CurrentStyle, context); form.StartDate = _schedule.VisibleDates[0]; form.EndDate = _schedule.VisibleDates[_schedule.VisibleDates.Count - 1]; bool? result = form.ShowDialog(); if (result.HasValue && result.Value) { // user clicks Ok // set PrintStyle properties according to user settings in a dialog CurrentStyle = form.SelectedStyle; HidePrivateAppointments = form.HidePrivateAppointments; SetupPrintContext(CurrentStyle, form.StartDate, form.EndDate); // print the document PrintDocument.Print(new System.Drawing.Printing.PrinterSettings()); _currentAppointments = null; } }