TransparentColor (C++)
Description
An example of TBitmap Color, TGraphic Transparent, TBitmap TransparentMode, TBitmap TransparentColor, and TCanvas Draw
Code
#include <memory> //For STL auto_ptr class
void __fastcall TForm1::Button1Click(TObject *Sender)
{
std::auto_ptr<Graphics::TBitmap> bitmap(new Graphics::TBitmap);
try
{
bitmap->LoadFromFile("..\\FACTORY.BMP ");
bitmap->Transparent = true;
bitmap->TransparentColor = bitmap->Canvas->Pixels[50][50];
Form1->Canvas->Draw( 0, 0, bitmap.get());
bitmap->TransparentMode = tmAuto;
Form1->Canvas->Draw(50, 50, bitmap.get());
}
catch (...)
{
ShowMessage("Could not load or display bitmap");
}
}
Uses
- Vcl.Graphics.TBitmap.Canvas ( fr | de | ja )
- Vcl.Graphics.TGraphic.Transparent ( fr | de | ja )
- Vcl.Graphics.TBitmap.TransparentMode ( fr | de | ja )
- Vcl.Graphics.TBitmap.TransparentColor ( fr | de | ja )
- Vcl.Graphics.TCanvas.Draw ( fr | de | ja )