本文介绍了在单页c#上打印两张图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在单页上打印两张图片。

我试过下面的代码,但是它打印的是不同页面上的所有图片。



I want to print two images on single page.
I have tried below code, but it is printing all images on different pages.

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;
    }
}



这将打印不同页面中的所有图像



我想要打印一个图像的一些功能,留下一些空间,如果剩余空间则再次在同一页面中显示其他图像。


this will print all images in different page

I want some functionality that will print one image ,leave some space and again prine other image in same page if space is remaining.

推荐答案


这篇关于在单页c#上打印两张图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 21:40