ANY ONE WHO CAN EXPLAIN THIS CODE FOR ME BY COMMENTING ON THE LINES THAT ARE IMPORTANT PLEASE HELP ME!!!!!
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "CastUnit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TCastForm *CastForm;
//---------------------------------------------------------------------------
__fastcall TCastForm::TCastForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TCastForm::DisableButtonMouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
for (int count = 0 ; count < CastForm->ComponentCount ; count++)
if(CastForm->Components[count]->ClassNameIs("TEdit"))
dynamic_cast <TEdit*>(CastForm->Components[count])->Enabled = false;
}
//---------------------------------------------------------------------------
void __fastcall TCastForm::DisableButtonMouseUp(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
for (int count = 0 ; count < CastForm->ComponentCount ; count++)
if(CastForm->Components[count]->ClassNameIs("TEdit"))
dynamic_cast <TEdit*>(CastForm->Components[count])->Enabled = true;
}
//---------------------------------------------------------------------------
void __fastcall TCastForm::ChangeColorButtonClick(TObject *Sender)
{
if (ChangeColorButton->Tag == 1)
{
for (int tel = 0 ; tel < CastForm->ComponentCount ; tel++)
if(CastForm->Components[tel]->ClassNameIs("TEdit"))
dynamic_cast <TEdit*>(CastForm->Components[tel])->Color = clYellow;
ChangeColorButton->Tag = 0;
}
else
{
if ( ChangeColorButton->Tag == 0)
for (int tel = 0 ; tel < CastForm->ComponentCount ; tel++)
if(CastForm->Components[tel]->ClassNameIs("TEdit"))
dynamic_cast <TEdit*>(CastForm->Components[tel])->Color = clWhite;
ChangeColorButton->Tag = 1;
}
}
//---------------------------------------------------------------------------
void __fastcall TCastForm::Edit1Click(TObject *Sender)
{
if(Sender->ClassNameIs("TEdit"))
Label1->Caption = dynamic_cast <TEdit*>(Sender)->Text;
if(Sender->ClassNameIs("TPanel"))
{
Label1->Caption = dynamic_cast <TPanel*>(Sender)->Caption;
if (dynamic_cast <TPanel*>(Sender)->Tag == 0)
{
dynamic_cast <TPanel*>(Sender)->Color = clRed;
dynamic_cast <TPanel*>(Sender)->Tag = 1;
}
else
{
dynamic_cast <TPanel*>(Sender)->Color = clBlue;
dynamic_cast <TPanel*>(Sender)->Tag = 0;
}
}
}
//---------------------------------------------------------------------------
void __fastcall TCastForm::Shape1MouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
dynamic_cast <TShape*>(Sender)->Brush->Color = ColorDialog1->Color;
if( dynamic_cast <TShape*>(Sender)->Shape == stRectangle)
{
dynamic_cast <TShape*>(Sender)->Shape = stCircle;
CastForm->Repaint();
}
else
if( dynamic_cast <TShape*>(Sender)->Shape == stCircle)
{
dynamic_cast <TShape*>(Sender)->Shape = stRoundSquare;
CastForm->Repaint();
}
else
if( dynamic_cast <TShape*>(Sender)->Shape == stRoundSquare)
{
dynamic_cast <TShape*>(Sender)->Shape = stRectangle;
CastForm->Repaint();
}
}
//---------------------------------------------------------------------------
void __fastcall TCastForm::Button1Click(TObject *Sender)
{
ColorDialog1->Execute();
}
//---------------------------------------------------------------------------