Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to paint the form with a tiled bitmap Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
10-Sep-02
Category
VCL-Forms
Language
Delphi 2.x
Views
89
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: William Gerbert

Paint the form with a tiled bitmap

Answer:

You may use this code to accomplish it:


1   type
2     TForm1 = class(TForm)
3       procedure FormCreate(Sender: TObject);
4       procedure FormPaint(Sender: TObject);
5     private
6       { private declarations }
7     public
8       { public declarations }
9       destructor Destroy; override;
10    end;
11  
12  var
13    Form1: TForm1;
14    Bitmap: TBitmap;
15  
16    ..
17  
18  procedure TForm1.FormCreate(Sender: TObject);
19  begin
20    Bitmap := TBitmap.Create;
21    Bitmap.LoadFromFile('C:\WINDOWS\cars.BMP');
22  end;
23  
24  destructor TForm.Destroy;
25  begin
26    inherited;
27    Bitmap.Free;
28  end;
29  
30  procedure TForm1.FormPaint(Sender: TObject);
31  var
32    X, Y, W, H: LongInt;
33  begin
34    with Bitmap do
35    begin
36      W := Width;
37      H := Height;
38    end;
39    Y := 0;
40    while Y < Height do
41    begin
42      X := 0;
43      while X < Width do
44      begin
45        Canvas.Draw(X, Y, Bitmap);
46        Inc(X, W);
47      end;
48      Inc(Y, H);
49    end;
50  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC