如何在vb6中打印图像

How to print images in vb6

我在 vb6 应用程序中有 tiff 图像(前后图像)。我正在将 tiff 图像从 fim 和 rim 文件保存到我的本地文件夹,然后我试图从那里打印图像。

最初我尝试将图像加载到 picturecox 并尝试打印图像,但是 tiff 图像无法以这种方式打印。我收到无效图片错误。 .bmp 和 .jpg 工作正常。

If pblnFlipped Then
        Set frmnewimage.img.Picture = Nothing
        frmnewimage.img.Picture = LoadPicture(mstrRearTiffImageFile)
        Else
        Set frmnewimage.img.Picture = Nothing
        frmnewimage.img.Picture = LoadPicture(mstrFrontTiffImageFile)
        End If
        Printer.PaintPicture frmnewimage.img.Picture, 100, 100
        Printer.EndDoc

所以我将图片保存到我的本地。但我不明白如何直接从保存的图像打印图像。请帮助我。

提前致谢!!!

我尝试过的:

If pblnFlipped Then
       Printer.PaintPicture mstrRearTiffImageFile, 10, 10
       Else
       Printer.PaintPicture mstrFrontTiffImageFile, 10, 10
       End If
       Printer.EndDoc

mstrRearTiffImageFile 和 mstrFrontTiffImageFile 是字符串(后图像和前图像)。它包含我需要打印的图像。根据图像类型 (pblnFlipped),我需要打印图像。

内置 VB6 image control as well as the Picture Box control 支持的文件格式不包括对 TIFF 文件的支持。

在将文件加载到 VB6 之前,您需要将文件转换为受支持的图像格式,或者创建或查找其他支持 TIFF 格式的自定义控件。

我不知道你为什么要在 VB6 中进行新开发,但你可能会发现使用其他具有更广泛图形支持的平台更容易实现你的目标,然后调用它来自您正在维护的任何 VB 代码。