Exemplo n.º 1
0
        private void toolStripButtonPrint_Click(object sender, EventArgs e)
        {
            Report report = new Report();

            report.ReportPages.Capacity = 1;
            ReportPage        reportPage = new ReportPage();
            ReportPictureItem reportItem = new ReportPictureItem();

            reportItem.Picture      = CurrentImage;
            reportItem.OldImageSize = reportItem.Picture.Size;
            reportItem.Bounds       = new Rectangle(new Point(0, 0), reportItem.Picture.Size);
            reportPage.ReportItems.Add(reportItem);
            report.ReportPages.Add(reportPage);
            reportFrom = new ReportForm(report);
            reportFrom.Show();
        }
Exemplo n.º 2
0
 private void CreateReportFrom()
 {
     if (imageListView.SelectedItems != null && imageListView.SelectedItems.Count == 0)
     {
         DialogResult result = MsgBox.Show(Properties.Resources.StrCannotPrintEmpty, Properties.Resources.StrWarning, MsgBox.Buttons.OK, MsgBox.Icon.Warning);
     }
     else
     {
         if (CanPrint())
         {
             if (imageListView.SelectedItems != null && imageListView.SelectedItems.Count > 0)
             {
                 Report report = new Report();
                 report.ReportPages.Capacity = imageListView.SelectedItems.Count;
                 for (int i = 0; i < imageListView.SelectedItems.Count; i++)
                 {
                     var fileExtension = Path.GetExtension(imageListView.SelectedItems[i].FileName);
                     if (fileExtension == ".png")
                     {
                         ReportPage        reportPage = new ReportPage();
                         ReportPictureItem reportItem = new ReportPictureItem();
                         string            fileName   = imageListView.SelectedItems[i].FileName;
                         reportItem.Picture      = new Bitmap(fileName);
                         reportItem.OldImageSize = reportItem.Picture.Size;
                         reportItem.Bounds       = new Rectangle(new Point(0, 0), reportItem.Picture.Size);
                         reportPage.ReportItems.Add(reportItem);
                         report.ReportPages.Add(reportPage);
                     }
                 }
                 reportFrom = new ReportForm(report);
                 reportFrom.ShowDialog();
             }
         }
         else
         {
             DialogResult result = MsgBox.Show(Properties.Resources.StrCannotPrint, Properties.Resources.StrWarning, MsgBox.Buttons.OK, MsgBox.Icon.Warning);
         }
     }
 }