-
Pictures in C++ Builder
I have a program that is an aircraft booking system. All the seats are images in green. What i want to do is when that image is clicked on it opens another picture which is a red version. So from the users perspective only the colour has changed and not the image. I'v tried looking about a bit and i think you have to use TImage, but i have no idea how the syntax is for things like telling it where the picture is on the hard drive etc.
If somone could write it out roughly how it should be i would be greatful,
thanx alot,
Jason
-
backgroundImage = new TImage(Owner);
backgroundCanvas = new TCanvas;
backgroundImage->Picture->LoadFromFile("androm.bmp");
HDC backgrounddc = CreateCompatibleDC(Canvas->Handle);
HBITMAP bkbmp = CreateCompatibleBitmap(Canvas->Handle, ClientWidth, ClientHeight);
SelectObject(backgrounddc, bkbmp);
SelectPalette(backgrounddc, backgroundImage->Picture->Bitmap->Palette, false);
backgroundCanvas->Handle = backgrounddc;
backgroundCanvas->StretchDraw( backgroundRect, backgroundImage->Picture->Bitmap);
-
Thanx m8, hav it working now
-
Don't forget to free the GDI resources you have Created after you have returned the HDC to its default state.
(or your app will stop redrawing after a few minutes)