1

TJvDBImage 是一个很好的组件,支持多种图片格式。在 JvJVCLUtils 中,提到可以通过 RegisterGraphicSignature 过程扩展支持的格式。在评论中提到:

WHAT IT IS:
   These are helper functions to register graphic formats than can
   later be recognized from a stream, thus allowing to rely on the actual
   content of a file rather than from its filename extension.
   This is used in TJvDBImage and TJvImage.

IMAGE FORMATS:
   The implementation is simple: Just register image signatures with
   RegisterGraphicSignature procedure and the methods takes care
   of the correct instantiation of the TGraphic object. The signatures
   register at unit's initialization are: BMP, WMF, EMF, ICO, JPG.
   If you got some other image library (such as GIF, PCX, TIFF, ANI or PNG),
   just register the signature:

     RegisterGraphicSignature(<string value>, <offset>, <class>)

     or

     RegisterGraphicSignature([<byte values>], <offset>, <class>)

   This means:
     When <string value> (or byte values) found at <offset> the graphic
     class to use is <class>

   For example (actual code of the initialization section):

     RegisterGraphicSignature([$D7, $CD], 0, TMetaFile); // WMF
     RegisterGraphicSignature([1, 0], 0, TMetaFile);     // EMF
     RegisterGraphicSignature('JFIF', 6, TJPEGImage);

   You can also unregister signature. IF you want use TGIFImage instead of
   TJvGIFImage, you can unregister with:

     UnregisterGraphicSignature('GIF', 0);

     or just

     UnregisterGraphicSignature(TJvGIFImage); // must add JvGIF unit in uses clause

   then:
     RegisterGraphicSignature('GIF', 0, TGIFImage); // must add GIFImage to uses clause

我按照说明在该单元的uses 子句中添加了GIFImage。另外,在程序 GraphicSignaturesNeeded 我添加了:

RegisterGraphicSignature('GIF', 0, TGIFImage);
RegisterGraphicSignature([$4D, $4d, 0, $2A], 0, TWICImage); // TIFF
RegisterGraphicSignature([$49, $49, $2A, 0], 0, TWICImage); // TIFF

TIFF 信息基于 提示:检测图形格式

然后我使用makemodified.bat重新编译JVCL。

在更改之前,将图像加载到 TJvDBImage 将加载文件并给出“位图图像无效”的无尽错误。更改后,拒绝加载文件并给出相同的错误1次。

如果我使用其他工具将 GIF / TIFF 图像加载到字段中,则在显示时,会出现上述无尽的错误。如果我使用上述链接功能加载字段内容,它可以完美地显示在 TImage 中。

那么,我错过了什么或做错了什么?

谢谢!

4

0 回答 0