3.3.1. WinMain
WinMain .
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->CreateForm(__classid(TMainForm), &MainForm);
Application->CreateForm(__classid(TSelectColorForm), &SelectColorForm);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
return 0;
}
3.3.2. proccess
TMainForm::proccess() , . .
__fastcall TMainForm::proccess() {
double res = 0, bres = 0;
double src;
try {
src = Src->Text.ToDouble();
} catch (EConvertError &e) {
src = 0.0;
Dst->Color = clRed;
Dst->Text = "";
Back->Color = clRed;
Back->Text = "";
return 0;
}
Dst->Color = clWindow;
Back->Color = clWindow;
int i = Variants->ItemIndex;
if (i > -1 && i < 16) {
if (actions[i] == '+') {
res = src + coeficients[i];
bres = src - coeficients[i];
}
if (actions[i] == '*') {
res = src * coeficients[i];
bres = src / coeficients[i];
}
}
Dst->Text = FloatToStrF(res, ffFixed, 8, 4);
Back->Text = FloatToStrF(bres, ffFixed, 8, 4);
}
TMainForm
TMainForm - .
class TMainForm: public TForm
{
__published: // IDE-managed Components
TLabel *Label1;
TEdit *Src;
TLabel *Label2;
TEdit *Dst;
TComboBox *Variants;
TMainMenu *MainMenu1;
TMenuItem *N1;
TMenuItem *N2;
TMenuItem *N3;
TMenuItem *N4;
TMenuItem *N5;
TLabel *Label3;
TEdit *Back;
void __fastcall N3Click(TObject *Sender); //
void __fastcall N2Click(TObject *Sender);
void __fastcall SrcChange(TObject *Sender);
void __fastcall FormResize(TObject *Sender);
void __fastcall VariantsChange(TObject *Sender);
void __fastcall N4Click(TObject *Sender);
private: // User declarations
int lwidth;
int lheight;
public: // User declarations
__fastcall TMainForm(TComponent* Owner);
__fastcall proccess();
};
TSelectColorForm
TSelectColorForm .
class TSelectColorForm: public TForm
{
__published: // IDE-managed Components
TColorBox *ColorBox;
TLabel *Label1;
TButton *OkButton;
void __fastcall OkButtonClick(TObject *Sender);
private: // User declarations
public: // User declarations
|
|
__fastcall TSelectColorForm(TComponent* Owner);
};
.
. . 4.1.
.4.1.
1. .
2. , (). . 4.2.
.4.3.
3. .
4. ( ), ( ). 4.4.
.4.4.
5. . : -> .
6. ( 4.5)
. 4.5.
7. , , ʻ. ( 4.6).
. 4.6.
8. : -> .
Borland Builder 6, /++, VCL. 5.1. .
.5.1.
, 10. 5.2.
.5.2.
. , , .. . , , .5.3.
.5.3. .
, . .
. 2 :
1.
. , 5.4.
|
|
2.
. , 5.5.
.5.4.
.5.5.
.5.4-5. .
Windows Borland Builder. -, . Win32 ++ VCL.
1. .. Borland C++ Builder: ++ . .: , 1997. 226. (681 193)
2. , . Borland C++ Builder. 21 .
3. , . Borland C++ Builder.
-, 1997, N 4.
4. .. C++ Builder 5. ., , 2002. - 368. (681 415)
5. . Borland C++ 5. .: , 2001. 976. (681 404)