0

1 ページに 2 つの画像を印刷したい。以下のコードを試しましたが、すべての画像を異なるページに印刷しています。

 public void PD_PrintPage(object sender, PrintPageEventArgs e)
    {

        float W = e.MarginBounds.Width;

        float H = e.MarginBounds.Height;

        for (; FileCounter >= 0; FileCounter--)
        {

            try
            {

                Bitmap Bmp = new Bitmap(BmpFiles[FileCounter]);

                if (Bmp.Width / W < Bmp.Height / H)

                    W = Bmp.Width * H / Bmp.Height;

                else
                    H = Bmp.Height * W / Bmp.Width;

                e.Graphics.DrawImage(Bmp, 0, 0, W, H);

                break;

            }

            catch
            {

            }

        }

        FileCounter -= 1;

        if (FileCounter > 0)
        {

            e.HasMorePages = true;

        }

        else
        {

            FileCounter = BmpFiles.Length - 1;

        }

    }

これにより、すべての画像が別のページに印刷されます

1つの画像を印刷し、スペースを残して、スペースが残っている場合は同じページに他の画像を再度印刷する機能が必要です。

4

3 に答える 3