[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
CppClxTImageList
It can be found in the header file QControls.hpp
Example to add two TImages at runtime and draw them to the Canvas of Form1.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
CppClxTImageList
(C++ CLX) TImageList
Component for storing TImages.It can be found in the header file QControls.hpp
Example to add two TImages at runtime and draw them to the Canvas of Form1.
//Note: Create a 1x1 bitmap image (e.g. by using Paint) and put it //in the program's folder! //Also, put a TImageList Component on the main TForm//Create TImageList const int width = 256; const int height = 256; ImageList1->Width = width; ImageList1->Height = height; //Create pImage std::auto_ptr<TImage> pImage(new TImage(0)); pImage->Picture->LoadFromFile("1x1.bmp"); pImage->Picture->Bitmap->Width = width; pImage->Picture->Bitmap->Height = height; pImage->Width = width; pImage->Height = height; //Draw first image in own scope { unsigned char * pLine; for (int y=0; y!=pImage->Height; ++y) { pLine=static_cast<unsigned char *>(pImage->Picture->Bitmap->ScanLine[y]); for (int x=0; x!=pImage->Width; ++x) { pLine[x*3+0]= x ; //Blue pLine[x*3+1]= y ; //Green pLine[x*3+2]= x+y; //Red } } ImageList1->Add(pImage->Picture->Bitmap,0); } //Draw second image in own scope { unsigned char * pLine; for (int y=0; y != pImage->Height; ++y) { pLine=static_cast<unsigned char *>(pImage->Picture->Bitmap->ScanLine[y]); for (int x=0; x != pImage->Width; ++x) { pLine[x*3+0]= x+y; //Blue pLine[x*3+1]= x ; //Green pLine[x*3+2]= y ; //Red } } ImageList1->Add(pImage->Picture->Bitmap,0); } ImageList1->Draw(this->Canvas,0,0,0,true); ImageList1->Draw(this->Canvas,width+1,0,1,true);
- include <memory> //For std::auto_ptr
Code links
'TImageList' links
- C++ VCL
- C++ Builder
- Pascal CLX
- Pascal VCL
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
