c++ - Load .png to TImage in Embarcadero C++Builder XE5 -
Let me know one. Need to load a PNG image because I need transparency. It is not an option to convert BMP into an example because I lose it transparency. How can I do this?
simply In the design time, it will make a .png file in the (Includes Delphi code and explanations as well as C ++ builder, because stdimage.hpp .
Image.Picture dialog. At runtime, you can create and load a TPngImage with the file, and keep it at
Image.Picture .
Include # lt; Stdimage.hpp & gt; __fastcall TForm1 :: TForm1 (TComponent * Owner): TForm (Owner) {TPngImage * img = new TPngImage (); img- & gt; LoadFromFile ("C: \\ Images \\ calculator.png"); Image1- & gt; Picture- & gt; Assign (img); Removing an IMG; }
TImage and
TPngImage both delphi classes And therefore it is relevant, and because C ++ builder users should be very familiar with translating Delphi code because the entire VCL is built on it. Besides,
TImage is a Delphi VCL component, one Delphi user can get the question and find the information too Is used.)
Process TForm4.Button1Click (Sender: TObject); Var PNG: TPNGimage; Start Png: = TPngImage.Create; Try Png.LoadFromFile ('C: \ Images \ calculator.png'); Image1.Picture.Assign (PNG); Finally Png.Free; End; End; More information in
Comments
Post a Comment