Поможем написать учебную работу
Если у вас возникли сложности с курсовой, контрольной, дипломной, рефератом, отчетом по практике, научно-исследовательской и любой другой работой - мы готовы помочь.
Если у вас возникли сложности с курсовой, контрольной, дипломной, рефератом, отчетом по практике, научно-исследовательской и любой другой работой - мы готовы помочь.
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "FigureUnit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormResize(TObject *Sender)
{
TriShapeI->Height=TriShapeI->Width;
TriShapeI->Canvas->MoveTo(2,TriShapeI->Width-2);
TriShapeI->Canvas->LineTo(2.5*TriShapeI->Width/5,1);
TriShapeI->Canvas->LineTo(TriShapeI->Width-2,TriShapeI->Width-2);
TriShapeI->Canvas->LineTo(2,TriShapeI->Width-2);
CircleShape->Left=ClientWidth/40;
SquareShape->Left=ClientWidth/40;
TriShapeI->Left=ClientWidth/40;
RectShape->Left=ClientWidth/40;
OvalShape->Left=ClientWidth/40;
CircleShape->Top=ClientHeight/10;
SquareShape->Top=2.7*ClientHeight/10;
TriShapeI->Top=4.2*ClientHeight/10;
OvalShape->Top=6.3*ClientHeight/10;
RectShape->Top=8.2*ClientHeight/10;
CircleShape->Top=ClientHeight/10;
SquareShape->Top=2.7*ClientHeight/10;
TriShapeI->Top=4.2*ClientHeight/10;
OvalShape->Top=6.3*ClientHeight/10;
RectShape->Top=8.2*ClientHeight/10;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btnStartClick(TObject *Sender)
{
lbCircle->Visible=False;
lbTri->Visible=False;
lbSquare->Visible=False;
lbRect->Visible=False;
lbOval->Visible=False;
lbWhite->Visible=False;
lbBlack->Visible=False;
lbBlue->Visible=False;
lbGreen->Visible=False;
lbRed->Visible=False;
lbYellow->Visible=False;
shapes[0]=lbCircle->Caption;
shapes[1]=lbTri->Caption;
shapes[2]=lbSquare->Caption;
shapes[3]=lbRect->Caption;
shapes[4]=lbOval->Caption;
colors[0]=lbWhite->Caption;
colors[1]=lbBlack->Caption;
colors[2]=lbBlue->Caption;
colors[3]=lbGreen->Caption;
colors[4]=lbRed->Caption;
colors[5]=lbYellow->Caption;
j=0;
k=0;
vopros();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::vopros ()
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::CircleShapeMouseDown(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
CircleShape->Brush->Color=clBtnFace;
SquareShape->Brush->Color=clBtnFace;
OvalShape->Brush->Color=clBtnFace;
RectShape->Brush->Color=clBtnFace;
sh=1;
if (col>0) {CircleShape->Brush->Color=RGB(r,g,b);}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SquareShapeMouseDown(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
CircleShape->Brush->Color=clBtnFace;
SquareShape->Brush->Color=clBtnFace;
OvalShape->Brush->Color=clBtnFace;
RectShape->Brush->Color=clBtnFace;
sh=2;
if (col>0) {SquareShape->Brush->Color=RGB(r,g,b);}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::OvalShapeMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
int X, int Y)
{
CircleShape->Brush->Color=clBtnFace;
SquareShape->Brush->Color=clBtnFace;
OvalShape->Brush->Color=clBtnFace;
RectShape->Brush->Color=clBtnFace;
sh=4;
if (col>0) {OvalShape->Brush->Color=RGB(r,g,b);}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::RectShapeMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
int X, int Y)
{
CircleShape->Brush->Color=clBtnFace;
SquareShape->Brush->Color=clBtnFace;
OvalShape->Brush->Color=clBtnFace;
RectShape->Brush->Color=clBtnFace;
sh=5;
if (col>0) {RectShape->Brush->Color=RGB(r,g,b);}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::TriShapeIMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
int X, int Y)
{
CircleShape->Brush->Color=clBtnFace;
SquareShape->Brush->Color=clBtnFace;
OvalShape->Brush->Color=clBtnFace;
RectShape->Brush->Color=clBtnFace;
sh=3;
if (col>0) {TriShapeI->Canvas->Brush->Color=RGB(r,g,b);
TriShapeI->Canvas->FloodFill(X,Y,fsBorder,clBlack);}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::WhiteShapeMouseDown(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
r=255; g=255; b=255; col=1;
if(sh>0)
switch (sh)
{
case 1: { CircleShape->Brush->Color=RGB(r,g,b);break;}
case 2: { SquareShape->Brush->Color=RGB(r,g,b);break;}
case 3: { TriShapeI->Canvas->Brush->Color=RGB(r,g,b);
TriShapeI->Canvas->FloodFill(X,Y,fsBorder,clBlack);break;}
case 4: { OvalShape->Brush->Color=RGB(r,g,b);break;}
case 5: { RectShape->Brush->Color=RGB(r,g,b);break;}
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::GreenShapeMouseDown(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
r=80; g=240; b=120; col=2;
if(sh>0)
switch (sh)
{
case 1: { CircleShape->Brush->Color=RGB(r,g,b);break;}
case 2: { SquareShape->Brush->Color=RGB(r,g,b);break;}
case 3: { TriShapeI->Canvas->Brush->Color=RGB(r,g,b)break;;
TriShapeI->Canvas->FloodFill(X,Y,fsBorder,clBlack);break;}
case 4: { OvalShape->Brush->Color=RGB(r,g,b);break;}
case 5: { RectShape->Brush->Color=RGB(r,g,b);break;}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::RedShapeMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
int X, int Y)
{
r=0; g=240; b=120; col=5;
if(sh>0)
switch (sh)
{
case 1: { CircleShape->Brush->Color=RGB(r,g,b);break;}
case 2: { SquareShape->Brush->Color=RGB(r,g,b);break;}
case 3: { TriShapeI->Canvas->Brush->Color=RGB(r,g,b);
TriShapeI->Canvas->FloodFill(X,Y,fsBorder,clBlack;break;}
case 4: { OvalShape->Brush->Color=RGB(r,g,b);break;}
case 5: { RectShape->Brush->Color=RGB(r,g,b);break;}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BlueShapeMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
int X, int Y)
{
r=160; g=240; b=120; col=3;
if(sh>0)
switch (sh)
{
case 1: { CircleShape->Brush->Color=RGB(r,g,b);break;}
case 2: { SquareShape->Brush->Color=RGB(r,g,b);break;}
case 3: { TriShapeI->Canvas->Brush->Color=RGB(r,g,b);
TriShapeI->Canvas->FloodFill(X,Y,fsBorder,clBlack;break;}
case 4: { OvalShape->Brush->Color=RGB(r,g,b);break;}
case 5: { RectShape->Brush->Color=RGB(r,g,b);break;}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BlackShapeMouseDown(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
r=0; g=0; b=0; col=4;
if(sh>0)
switch (sh)
{
case 1: { CircleShape->Brush->Color=RGB(r,g,b);break;}
case 2: { SquareShape->Brush->Color=RGB(r,g,b);break;}
case 3: { TriShapeI->Canvas->Brush->Color=RGB(r,g,b);
TriShapeI->Canvas->FloodFill(X,Y,fsBorder,clBlack;break;}
case 4: { OvalShape->Brush->Color=RGB(r,g,b);break;}
case 5: { RectShape->Brush->Color=RGB(r,g,b);break;}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::YellowShapeMouseDown(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
r=40; g=240; b=120; col=6;
if(sh>0)
switch (sh)
{
case 1: { CircleShape->Brush->Color=RGB(r,g,b);break;}
case 2: { SquareShape->Brush->Color=RGB(r,g,b);break;}
case 3: { TriShapeI->Canvas->Brush->Color=RGB(r,g,b);break;
TriShapeI->Canvas->FloodFill(X,Y,fsBorder,clBlack;break;}
case 4: { OvalShape->Brush->Color=RGB(r,g,b);break;}
case 5: { RectShape->Brush->Color=RGB(r,g,b);break;}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btnCancelClick(TObject *Sender)
{
CircleShape->Brush->Color=clBtnFace;
SquareShape->Brush->Color=clBtnFace;
OvalShape->Brush->Color=clBtnFace;
RectShape->Brush->Color=clBtnFace;
col=0; sh=0;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btnOkClick(TObject *Sender)
{
if (sh>0 && col>0)
{
if (sh=shape+1 &&)
{
k++;
j++;
if (j<10) vopros();
else lbqwe->Caption="Rez";
}
}
}
//---------------------------------------------------------------------------
if (X>=CircleShape->Left $$ X<=CircleShape->Left+Width && Y>=CircleShape->Top && Y<CircleShape->Top+Height)
{
}