General discussion

Locked

Loading image to TPaintBox Structure

By Neil Cotton ·
Posted - 04/07/2005 : 11:58:22 AM


--------------------------------------------------------------------------------

I am trying to load an image from a OpenFile dialouge box, into a fixed size paint box, and am prooving very uncessessful.

I have managed to do exactly the same thing to load to a TImage structure, by using the following code.


quote:
--------------------------------------------------------------------------------

if (!dlgOpenImage -> Execute()) return;
imgDest->Picture->Bitmap->LoadFromFile(dlgOpenImage->FileName);
--------------------------------------------------------------------------------


Which works fine, however when I try and use similar strategy for a TPaintBox it doens't want to know.

This is what I am currently working with


quote:
--------------------------------------------------------------------------------

void __fastcall TfrmMain::Fi1Click(TObject *Sender)
{
//bool LoadImage = NULL;
LoadImage = new Graphics::TBitmap;

if (!dlgOpen->Execute()) return;
pbxClientArea->Canvas->??;
LoadImage->LoadFromFile(dlgOpen->FileName);

LoadImage->Width=pbxClientArea->Width;
LoadImage->Height=pbxClientArea->Height;

TRect rect(0,0, LoadImagemage->Width, LoadImage->Height);
//LoadImage->Canvas->Brush->Color=clWhite;
LoadImage->Canvas->FillRect(rect);
}

--------------------------------------------------------------------------------


where pbxClientArea is the destination paint box for the image to be loaded. and LoadImage is to be a residiual location for the dlgOpen file to be stored untill it is transfered to the paint box.

I dont know if i am going the correct way around it. Probably not.


.....HELP?

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Wrong forum.

by deepsand In reply to Loading image to TPaintBo ...

This is a tech. problem, in search of a solution.

It properly belongs in "Technical Q&A," not in "Discussions." Please re-post there.

Not only will you be more likely to attract the attention of those seeking to provide answers, but you will also make it easier for those seeking discussions to find such.

Thank you.

Back to Web Development Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums