TBrush.Bitmap and 8x8 ?

Giganews Newsgroups
Subject:TBrush.Bitmap and 8x8 ?
Posted by: David HAROUCHE
Date:Mon, 26 Oct 2009

Help says (D7perso) :

"...If the image is larger than eight pixels by eight pixels, only the top
left eight-by-eight region is used."

This is completely false :

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Batchs, Spaces, ExtCtrls, ExtDlgs;

type
  TForm1 = class(TForm)
    Image1: TImage;
    OpenPictureDialog1: TOpenPictureDialog;
    procedure FormPaint(Sender: TObject);
    procedure FormDblClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormPaint(Sender: TObject);
begin
    self.Canvas.Brush.Bitmap := TBitmap.Create;

    self.Canvas.Brush.Bitmap.Assign(self.Image1.Picture.Bitmap);

    self.Canvas.FillRect(self.ClientRect);

    self.Canvas.Brush.Bitmap.Free;
end;

procedure TForm1.FormDblClick(Sender: TObject);
begin
    if self.OpenPictureDialog1.Execute
        then self.Image1.Picture.Bitmap.LoadFromFile(
self.OpenPictureDialog1.FileName);
end;

end.

Can someone confirm that I can use even a bitmap of 2048x2048 as the brush
pattern ?
--
DH
blueperfe…@hotmail.fr

Replies