//--------------------------------------------------------------------------- #include #pragma hdrstop #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::FormDestroy(TObject *Sender) { for (int x=0; x < 8; x++) for (int y=0; y < 8; y++) DeleteObject(o[x][y]); } //--------------------------------------------------------------------------- void __fastcall TForm1::FormPaint(TObject *Sender) { Canvas->Draw(0,0,b); } //--------------------------------------------------------------------------- void __fastcall TForm1::FormMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { for (int x=0; x < 8; x++) for (int y=0; y < 8; y++) if(PtInRegion(o[x][y],X,Y)) InvertRgn(b->Canvas->Handle,o[x][y]); InvalidateRect(Handle, NULL, FALSE); } //--------------------------------------------------------------------------- void __fastcall TForm1::FormCreate(TObject *Sender) { b=new Graphics::TBitmap; b->LoadFromResourceID((int)HInstance, 100); ClientWidth=b->Width; ClientHeight=b->Height; for (int x=0; x < 8; x++) for (int y=0; y < 8; y++) o[x][y]=CreateRectRgn(2+49*x,2+49*y,49*(x+1),49*(y+1)); } //---------------------------------------------------------------------------