//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "CustomFormCanvas.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// BeginExample: CustomFormCanvas
// Property: Forms.TCustomForm.Canvas
// Property: Graphics.TCanvas.Brush
// Property: Graphics.TBrush.Bitmap
// Method: Graphics.TCanvas.FillRect

// BeginCode
/*
The following code loads a bitmap from a file and assigns it
to the Brush of the Canvas of Form1:
*/

#include <memory>       //for STL auto_ptr class

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  std::auto_ptr<Graphics::TBitmap> BrushBmp(new Graphics::TBitmap);
  BrushBmp->LoadFromFile("../bm1.BMP");
  Form1->Canvas->Brush->Bitmap = BrushBmp.get();
  Form1->Canvas->FillRect(Rect(0,0,100,100));
  Form1->Canvas->Brush->Bitmap = NULL;
}
// EndCode
// EndExample: CustomFormCanvas
//---------------------------------------------------------------------------
