Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading an image to Canvas

Status
Not open for further replies.

cyprus106

Programmer
Apr 30, 2001
654
How do I load an image to a Forms' Canvas? Does anyone have any Sample code for this?

Thanks, Cyprus
 
What kind of form (SDI or MDI)? If your form/application is SDI, you have to monitor win-message WM_ERASEBGRND (or something like that, check WIN SDK help :( ,anyway, it is the message sent by Windows telling you to erase background of your window. This is where you can blit your image on form's Canvas instead of erasing it. In case of MDI-parent form, this wont work, because VCL adds one more frame over your window, so you can't draw on form. This is a bit tricky, but you can find a good explanation and sample code on borland.com (cpp-faq)
 
um, no I want to display an image on the forms canvas in BCB5. All it takes is some simple code on the forms part, but I can't remember it and I would like to know if anyone else who can remember it could help me. Cyprus
 
Greetinx!

Each TCanvas has method of BrushCopy which can copy bitmap onto itself. So, you can try to make this copying either on WM_ERASEBKGND or WM_PAINT has come.

Happy programming!))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top