Link to home
Start Free TrialLog in
Avatar of 966
966

asked on

PNG Components

Hi, ive installed PNGComponents, and it doesnt let me load a file into timage called PNG. It only allows JPG, ico.. but no PNG.

How do i get PNG to load into the program im making at design time. The same way the timage normally works with a bmp.
Avatar of Emmanuel PASQUIER
Emmanuel PASQUIER
Flag of France image

if you are using the same componnent that I'm using, there is a code line responsible for that at the end of pngimage.pas in the initialization section :

  {$IFDEF UseDelphi}{$IFDEF RegisterGraphic}
    TPicture.RegisterFileFormat('PNG', 'Portable Network Graphics', TPNGObject);
  {$ENDIF}{$ENDIF}

which register the PNG file format in the TPicture class. Make sure you add this pngImage in the uses of your project, and check in debug that this line is compiled (there could be a pb with conditional defines) & executed. If not, then maybe it's because you have added the unit in your project (not only in the uses) and it is therefore recompiled without the UseDelphi & RegisterGraphic conditionals.
either remove it from the project, or add the conditionals in your project (which is not the best option, but could help you moving on before fixing properly)
Avatar of 966
966

ASKER

Thanks for the help. I used an auto installer that was a .exe that did it all for me. Ive added pngimage in uses, but i still cannt have the option to import the png in, its dam odd.
Avatar of 966

ASKER

is there some code i have to type, or should it work the same way as timage? Like.. when i drop an image on a delphi form, and select picture props and i should be able to browse a PNG right?
ASKER CERTIFIED SOLUTION
Avatar of Emmanuel PASQUIER
Emmanuel PASQUIER
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 966

ASKER

im using the same one. i did a search for PNG_D>.pdk it cant find it on my computer anywhere. where is it located \delphi ??  so you think if i reinstall the whole pngcomponents it will work maybe?
Avatar of 966

ASKER

yeah ur right mate, i reinstall did the trick. I checked that line of code in the section and this time it compiled. cheers mate, ur a star
Avatar of 966

ASKER

Great!