What image types does VB6 support?

亡梦爱人 提交于 2020-01-06 07:57:16

问题


What specific picture or image types & formats does VB6 support?

I can find specific examples here on SO but I haven't seen any comprehensive information.

I am mainly interested in what can be used "natively" by VB6, though I am sure there are third-party libraries and/or other methods of loading additional image types.


回答1:


The function LoadPicture (loosely) defines what graphics formats are "supported by VB6" in a native sense. Here are the relevant details:

Loads a graphic into a forms Picture property, a PictureBox control, or an Image control.

...

Graphics formats recognized by Visual Basic include bitmap (.bmp) files, icon (.ico) files, cursor (.cur) files, run-length encoded (.rle) files, metafile (.wmf) files, enhanced metafiles (.emf), GIF (.gif) files, and JPEG (.jpg) files.

Additional information based on a useful external post:

There are many types of picture files, and some of them have multiple "sub types" too. Unfortunately several popular types have been created (or extended) since VB6 was released, so it does not support them.

Supported file types

This is the list of types shown in the help for VB6 (under LoadPicture):

Graphics formats recognized by Visual Basic include:

  • bitmap (.bmp) files,
  • icon (.ico) files,
  • cursor (.cur) files,
  • run-length encoded (.rle) files,
  • metafile (.wmf) files,
  • enhanced metafiles (.emf),
  • GIF (.gif) files,
  • and JPEG (.jpg) files.

A note about icon (.ico) files

These have evolved over the years, and many of the icons you find on the web are not supported.

VB6 only supports icons that have a size of 32x32 or 16x16, and a color depth of "True Color" (24-bit) or "256 Colors" (8 bit) or less - so no alpha channel (32 bit).

If you find icons that are described as "XP icons" or "Vista icons", they are unlikely to load in VB - if they do, it is because suitable icons are also included in the file too (a .ico file can contain multiple pictures).

You can convert icons to a suitable format using an icon editing program...

Other file types

If the file type you want to load is not listed above, you will need to do some extra work.

The easiest way (if you only have a few files) is to use a paint program to convert the picture file to one of the types listed above.

There are many situations where that is not valid (such as when you want the user to be able to load .png files), in which case you either need to find pre-written code (or a component) to load the file for you, or write the code yourself.



来源:https://stackoverflow.com/questions/54253744/what-image-types-does-vb6-support

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!