Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

rossco

Opening a picture file in C/C++

This topic is 5234 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there, I''m using Borland C++ Builder 4 IDE. I want to load a picture file onto a form at run time - What is the code to do this ? Thank you for your time

Share this post


Link to post
Share on other sites
Advertisement
I have no idea of the code, though I done it before...

Put a TBitmap object pointer in your form class, heres the basic idea:


class MyForm : public TForm
{
...
TBitmap *pBitMap;
...
};

...
MyForm::MyForm(...)
{
pBitMap = 0;
}
...
// OnCreate or Onload, whatever its called
MyForm::OnLoad(...)
{
pBitMap = new TBitmap([path to file]); //
// You might need to call a function to load the image

// mess around with properties to show, position,
// ie Code similar in similar format to pBitMap->Pos(x, y)
//pBitMap->Show(); // I think this shows a control
}


MyForm::~MyForm(..)
{
delete(pBitMap)
}
...


Hope this helps, its fairly straight forward,

Keith

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!