Thread: Pictures in C++ Builder

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    21

    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

  2. #2
    _Enixia_
    Guest
    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);

  3. #3
    Registered User
    Join Date
    Dec 2002
    Posts
    21
    Thanx m8, hav it working now

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    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)
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Tagging Pictures
    By Tonto in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 03-17-2008, 02:44 PM
  2. Builder C++ large files support for simple C program
    By Murfury in forum C Programming
    Replies: 3
    Last Post: 11-23-2007, 03:47 PM
  3. THE END - Borland C++ Builder, Delphi, J Builder?
    By Davros in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 02-28-2006, 11:23 PM
  4. Builder woes
    By Laserve in forum Windows Programming
    Replies: 0
    Last Post: 07-22-2004, 06:19 AM
  5. Project Builder console app
    By Luigi in forum C++ Programming
    Replies: 0
    Last Post: 12-28-2002, 07:57 PM