private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { if (m_calendarToPrint == null) { e.HasMorePages = false; return; } CalendarTableDrawer ctd = new CalendarTableDrawer(); ctd.PaddingTop = Math.Abs(e.MarginBounds.Top - e.PageBounds.Top); ctd.PaddingRight = Math.Abs(e.MarginBounds.Right - e.PageBounds.Right); ctd.PaddingLeft = Math.Abs(e.PageBounds.Left - e.MarginBounds.Left); ctd.PaddingBottom = Math.Abs(e.PageBounds.Bottom - e.MarginBounds.Bottom); ctd.Draw(e.Graphics, e.PageBounds.Size, m_calendarToPrint, printYearStart, printMonthStart); printMonthStart++; if (printMonthStart > 12) { printMonthStart = 1; printYearStart++; } e.HasMorePages = ((printYearStart * 12 + printMonthStart) <= (printYearEnd * 12 + printMonthEnd)); return; }
private void exportToolStripMenuItem_Click(object sender, EventArgs e) { if (p_mode == 0) { FrameMain.SaveContentPlain(m_calendar); } else if (p_mode == 2) { SaveFileDialog sfd = new SaveFileDialog(); string dir; string locationFileName = calLocation.GetNameAsFileName(); sfd.Filter = "PNG image - current month (*.png)|*.png|HTML pages - whole year (*.html)|*.html"; sfd.FileName = locationFileName; if (sfd.ShowDialog() == DialogResult.OK) { dir = Path.GetDirectoryName(sfd.FileName); switch (sfd.FilterIndex) { case 1: CalendarTableDrawer.ExportPng(calLocation, dir, locationFileName, calendarTableView1.CurrentYear, calendarTableView1.CurrentMonth); break; case 2: CalendarTableDrawer.ExportPngYear(calLocation, dir, locationFileName, calendarTableView1.CurrentYear); break; } } } }