Go Back   Wiki NewForum | Latest Entertainment News > Career Forum & Tips > Tech Forum & Tutorial > Oracle Database, SQL, Application, Programming


Windows, web pages, multimedia programs, all have backgrounds. How come your Delphi f


Reply
Views: 1485  
Thread Tools Rate Thread
  #1  
Old 08-20-2010, 10:46 AM
bholas bholas is offline
Award Winner
 
Join Date: Apr 2010
Posts: 4,977
Default Windows, web pages, multimedia programs, all have backgrounds. How come your Delphi f

Of course you could place a "TImage" component on your form and set its "Alignment" to "Client" in order to place a background image on your form. Here's another way: Add following code to your form's "Public declarations" section:
bmpBackground : TBitmap;

Double click on your form and add bitmap initialization code in the "FormCreate" event:
bmpBackground := TBitmap.Create;
bmpBackground.
LoadFromFile( 'c:windowssetup.bmp' );

Go to the form's events list and double click on "OnPaint". Add following line to the "FormPaint" event:
Canvas.Draw( 0, 0, bmpBackground );

Finally insert the following code in to the "FormDestroy" event ("OnDestroy" event):
bmpBackground.Free;

Sample screen shot:


Reply With Quote
Reply

Tags
programming tips

New topics in Oracle Database, SQL, Application, Programming





Powered by vBulletin® Version 3.8.10
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
WikiNewForum)