DOC

HOW TO PAINT THE FORM WITH A BITMAP.

By Leon Lopez,2014-03-12 08:53
7 views 0
HOW TO PAINT THE FORM WITH A BITMAP.

    How to paint the form with a bitmap. 发信人: strayli (stray), 信区: Delphi

     : How to paint the form with a bitmap. 发信站: BBS 水木清华站 (Mon Sep 21 13:54:00 1998) KEYWORDS: paint form bitmap AREA: VCL Programming Q: How do I paint the background of my form with a bitmap as tiles?

    A:

    unit Unit1;

    interface

    uses

     WinTypes, WinProcs, Messages, Classes, Graphics, Controls, SysUtils,

     Forms, Dialogs;

    type

     TForm1 = class(TForm)

     procedure FormCreate(Sender: TObject);

     procedure FormPaint(Sender: TObject);

     private

     { Private declarations }

     public

     { Public declarations }

     end;

    var

     Form1: TForm1;

     Bitmap: TBitmap;

    implementation

    {$R *.DFM}

    procedure TForm1.FormCreate(Sender: TObject); begin

     Bitmap := TBitmap.Create;

     Bitmap.LoadFromFile('C:\WINDOWS\cars.BMP'); end;

    procedure TForm1.FormPaint(Sender: TObject); var

     X, Y, W, H: LongInt;

    begin

     with Bitmap do begin

     W := Width;

     H := Height;

     end;

     Y := 0;

     while Y < Height do begin

     X := 0;

     while X < Width do begin

     Canvas.Draw(X, Y, Bitmap);

     Inc(X, W);

     end;

     Inc(Y, H);

     end;

    end;

    end.

    --

    ※来源:?BBS 水木清华站 bbs.net.tsinghua.edu.cn?[FROM: 210.45.208.4]

Report this document

For any questions or suggestions please email
cust-service@docsford.com