View Single Post
  #1 (permalink)  
Old April 7th, 2005, 06:58 AM
sencee sencee is offline
Authorized User
 
Join Date: May 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to sencee Send a message via AIM to sencee Send a message via MSN to sencee Send a message via Yahoo to sencee
Default Load Image from file to TPaintBox

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:
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:
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?

Reply With Quote