private void btnPrint_Click(object sender, EventArgs e) { PrintableComponentLink pcl = new PrintableComponentLink(new PrintingSystem()); pcl.Component = this.schedulerControl1; // Set page margins. pcl.Margins = new System.Drawing.Printing.Margins(30, 30, 30, 30); DailyPrintStyle pStyle = this.schedulerControl1.ActivePrintStyle as DailyPrintStyle; // Set fonts for appointments and column headings. pStyle.AppointmentFont = new Font("Arial", 8, FontStyle.Regular); pStyle.HeadingsFont = new Font("Arial", 10, FontStyle.Regular); // Specify whether the Calendar header should be printed. pStyle.CalendarHeaderVisible = false; // Specify the intervals to print. pStyle.PrintTime = new TimeOfDayInterval(timeEdit1.Time.TimeOfDay, timeEdit2.Time.TimeOfDay); pStyle.StartRangeDate = dateEdit1.DateTime.Date; pStyle.EndRangeDate = dateEdit2.DateTime.Date; // Specify resources to print. pStyle.ResourceOptions.CustomResourcesCollection.Add(schedulerStorage1.Resources[0]); pStyle.ResourceOptions.PrintCustomCollection = true; pStyle.PrintAllAppointments = false; pcl.CreateDocument(); pcl.ShowPreviewDialog(); }
private void btnUseDayViewScale_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { #region #customizeprintstyle DailyPrintStyle printStyle = (DailyPrintStyle)schedulerControl1.PrintStyles[SchedulerPrintStyleKind.Daily]; printStyle.UseActiveViewTimeScale = true; printStyle.PrintTime.Start = schedulerControl1.SelectedInterval.Start.TimeOfDay; printStyle.PrintTime.End = schedulerControl1.SelectedInterval.End.TimeOfDay; if ((this.schedulerControl1.DayView.TimeScale.Minutes < 30) && (printStyle.PrintTime.Duration.TotalHours > 4)) { printStyle.CalendarHeaderVisible = false; printStyle.AutoScaleHeadingsFont = false; printStyle.HeadingsFont = new Font("Verdana", 8); printStyle.AppointmentFont = new Font("Verdana", 8); } schedulerControl1.ShowPrintPreview(printStyle); #endregion #customizeprintstyle }
private void SetPrintStyle() { DailyPrintStyle pStyle = this.schedulerControl1.ActivePrintStyle as DailyPrintStyle; // Set fonts for appointments and column headings. pStyle.AppointmentFont = new Font("Arial", 8, FontStyle.Regular); pStyle.HeadingsFont = new Font("Arial", 10, FontStyle.Regular); // Specify whether the Calendar header should be printed. pStyle.CalendarHeaderVisible = false; // Specify the intervals to print. DateTime dt = DateTime.Now; pStyle.PrintTime = new TimeOfDayInterval(dt.TimeOfDay, dt.AddHours(4).TimeOfDay); pStyle.StartRangeDate = dt.Date; pStyle.EndRangeDate = dt.AddDays(3).Date; // Specify resources to print. //pStyle.ResourceOptions.CustomResourcesCollection.Add(schedulerStorage1.Resources[0]); //pStyle.ResourceOptions.PrintCustomCollection = true; pStyle.PrintAllAppointments = false; }