C++ Builder

  • View
    462

  • Download
    0

Embed Size (px)

DESCRIPTION

C++ Builder in Exemple

Transcript

  • C + + B u i l d e r

    -

    -

    2005

  • 681.3.068+800.92++ 32.973.26-018.1

    90 . .

    90 C++ Builder ., 2005. 336 : .

    ISBN 5-94157-631-5

    - .: -

    -

    C++ Builder. - -

    , -

    C++ Builder. - -

    . -

    .

    681.3.068+800.92++ 32.973.26-018.1

    :

    .

    .

    .

    02429 24.07.00. 24.08.05. 60x90 Vie. . . . . 21.

    5000 . 1241"-", 194354, -, . , 5.-

    77.99.02.953..006421.11.04 11.11.2004 . .

    " ""

    199034, -, 9 , 12

    I S B N 5-94157-631-5 . ., 200S , "-", 2005

  • 1

    1. 3

    5 5 6- 10 12 16 18 21 25 28 33 36-2 43 48 51 -2 54 Internet Explorer 57 58

    62 62 65 70 ...-. 75

  • IV_

    81 81..... 81 84 87 90 93 100 104- 109 114 118 121

    124 124WAV 124 Player 128 MIDI '. 138Compact Disk Player ( 1) 142Compact Disk Player ( 2) 148Video Player 150 158

    161 161 162 166 172

    180 180 15 192 " " (Puzzle) 198 " " 207 218-2 232

  • V

    241 246 255 ..259

    265 265 ...., 266 . 266 267 267 268 268 269 269 : 269 270 270 271 271 272 272 ( ) 272 273 "" 273

    2. BORLAND C++ BUILDER - 275

    277 278

    Label 279Edit 280Button . 281Memo 283RadioButton 284CheckBox 285ListBox 286

  • VI

    ComboBox 287StringGrid 288Image 290Timer 291SpeedButton :..., .292UpDown 294ProgressBar 295StatusBar 296Animate 297MediaPlayer..... 298Table 299Query .....300DataSource..... ......301DBEdit, DBMemo, DBText 301DBGrid 302DBNavigator 304

    306Canvas 306Pen. 309Brush 310

    , 310 ...., 310 311 312 313

    315 315

    . CD-ROM 317

    324

  • .

    . -

    , , , -

    , , .

    , -

    ,

    " ". -

    RAD- (Rapid Application Development ) ,

    ,

    ,

    . -

    RAD- ! RAD- BorlandC++Builder, : -

    . -

    Borland C++Builder C++. , -

    , . -

    . -

    ,

    .

    , ,

    , -

    , , ,

  • , , -

    . , -

    -

    .

    .

    , -

    ,

    .

    , -

    -

    .

    ,

    . , ,

    . -

    ,

    . , ,

    . -

    .

    - , -

    , C++Builder , -, . . C++Builder. .:-, 2004. ,, -

    , : , , Mi-crosoft Help Workshop, , , - installShield Express, ( - ).

  • 1

  • , -

    .

    C++Builder : (), . - ( , - Windows) - .

    ,

    () .

    . :

    Label ; Edit ; Button ; checkBox ; RadioButton ; ListBox ; comboBox .

    , -

    () (

    ).

  • 1.

    -

    ( ).

    ( Edit), (- ListBox) (comboBox). - CheckBox RadoiButton.

    -

    ( Label) (ShowMessage, MessageDlg).

    , ,

    ,

    strTomt, strToFioat. - , , ,

    intTostr, F l o a t T o S t r F l o a t T o S t r F .

    .

    TextBox L a b e l . -

    , -

    (). - . 1.1.

    \ ' ' " j f l l

    Label4

    Buttoni

    ,

    ":1~. (/$>

    '

    - Editi

    - Edit2

    -Button2

    . 1 . 1 .

  • // void fastcall TForml::EditlKeyPress(TObject *Sender, char&Key){

    // , //

    // Key - // , if ((Key >= '0') && (Key Text).Pos(DecimalSeparator) != 0)Key = 0; //

    return;

    if (Key == VK_BACK) // return;

    if (Key == VK_RETURN) // {

    Edit2->SetFocus();return;

    // Key = 0 ; //

  • 8 1.

    // void fastcall TForml::Edit2KeyPress(TObject *Sender,

    char &Key){

    if ((Key >= '0') && (Key Text).Pos(DecimalSeparator) != 0)

    Key = 0 ; // return;

    if (Key == VK_BACK) // return;

    if (Key == VK_RETURN) // I

    Buttonl->SetFocus();// // // return;

    // Key = 0 ; //

    // void fastcall TForml::ButtonlClick(TObject *Sender)

    float usd; //

  • float ; // float rub; //

    // , if (((Editl->Text).Length() ==0) ||

    ((Edit2->Text).Length)) == 0)){

    MessageDlgC'Haflo ",

    mtlnformation, TMsgDlgButtons() mbOK, 0);if ((Editl->Text).Length!) == 0)

    Editl->SetFocus(); // else

    Edit2->SetFocus(); // return;

    // usd = StrToFloat(Editl->Text);k = StrToFloat(Edit2->Text);

    // rub = usd * k;

    // Label4->Caption = FloatToStrF(usd,ffGeneral,7,2) +

    "$ = "+FloatToStrF(rub,ffGeneral,7,2) + " ."

    // void fastcall TForml::Button2Click(TObject *Sender){

    Forml->Close(); //

  • 10 1.

    -

    -,

    . 1.2, . ,

    ,

    .

    Editl -

    Label2

    .

    I - Buttoni

    . 1.2. ,

    f a s t c a l l T F o r m l : : T F o r m l ( T C o m p o n e n t * Owner) : TForm(Owner){

    /* Editl ( ), */Buttonl->Enabled = False;

    // Editlvoid fastcall TForml::EditlKeyPress(TObject *Sender, char&Key){

    / / , //

    // Key - // , if ( (Key >= '0') && (Key

  • 11_

    // DecimalSeparator// , // if (Key == DecimalSeparator){

    if ((Editl->Text).Pos(DecimalSeparator) ! = 0)Key = 0 ; //

    return;

    if (Key == VK_BACK) // return;

    if (Key == VK_RETURN) // {

    Buttonl->SetFocus();return;

    // Key = 0 ; //

    // Editl void fastcall TForml::EditlChange(TObject *Sender){

    // , Editl if ( (Editl->Text).Length() == 0)

    Buttonl->Enabled = False; // . else Buttonl->Enabled = True; // .

    Label2->Caption = "";

  • 12 1.

    // void fastcall TForml::ButtonlClick(TObject *Sender){

    double funt; // double kg; //

    // ,// Editl . ,// .funt = StrToFloat(Editl->Text);kg = funt * 0.4995;

    Label2->Caption = FloatToStrF(funt,ffGeneral,5,2) +" . - " +

    FloatToStrF(kg,ffGeneral,5,2) + " ";

    -

    TextBox Label, " ". . 1.3.

    ()-

    ()-

    LabeU -

    Buttoni -. I; : : : *

    EdiH

    - Edit2

    - Button2

    . 1.3. .

    / / void f a s t c a l l T F o r m l : : B u t t o n l C l i c k ( T O b j e c t *Sender)

  • / 3

    float u; // float r; // float i; //

    // , // if ( ((Editl->Text).Length() ==0) ||

    ((Edit2->Text).Length() == 0)){

    MessageDlg(" ",mtlnformation, TMsgDlgButtons() Text).Length() == 0)Editl->SetFocus(); //

    elseEdit2->SetFocus; //

    return;

    // u = StrToFloat(Editl->Text); = StrToFloat(Edit2->Text);

    // try

    {i = u/r;

    }catch (EZeroDivide &e){

    ShowMessage(" "" ");

    Edit2->SetFocus(); // return;

  • 14 1.

    // LabelsLabel4->Caption - " : " +

    FloatToStrF(i,ffGeneral,7,2) + " A";

    // // , // void fastcall TForml::EditlKeyPress(TObject *Sender,

    char &Key){

    // Key - // ,

    if ( ( Key >= '0') && ( Key Text).Pos(DecimalSeparator) != 0 )Key = 0 ; //

    return;

    if (Key == VK_BACK) // return;

    if ( Key == VK_RETURN) //

    Edit2->SetFocus();return;

  • 75

    // Key = 0; //

    // void fastcall TForml::Edit2KeyDown(TObject *Sender,

    WORD &Key,TShiftState Shift){

    if ( ( Key >= '0') && ( Key Text).Pos(DecimalSeparator) != 0 )

    Key = 0; // return;

    if (Key == VK_BACK) // return;

    if ( Key == VK_RETURN) // I

    Buttonl->SetFocus(); // // // // . ButtonlClick

    return;

    // Key = 0 ; //

    // void fastcall TForml::Button2Click(TObject 'Sender)

  • 16 1.

    Forml->Close(); //

    /* EditlChange Change Editl, Edit2.- Change Editl, - Change Edit2 EditlChange. */

    void fastcall TForml::EditChange(TObject *Sender){

    Label4->Caption = "";

    , . 1.4, - , -

    , -

    . RadioButton.

    RadioButtoni

    RadioButton2

    ,

    I

    j ^

    Label4

    . 1.4.

  • 17_

    // void fastcall TForml::ButtonlClick(TObject *Sender){

    float rl,r2,r;

    rl = StrToFloat(Editl->Text);r2 = StrToFloat(Edit2->Text);

    /* RadioButtonl RadioButton2,

    */ ( RadioButtonl->Checked ){

    // "" = rl + 2;

    ela*

    / / ""// / / EInvalidOpt r y

    { = ( r l * r2) / ( r l + r 2 ) ;

    }catch ( EInvalidOp &e){

    ShowMessage(" """);

    return;

    Label4->Caption = FloatToStrF(r, ffGeneral, 6,2) + " ";

    }

  • 18 1.

    II ""

    void fastcall TForml::RadioButtonlClick(TObject *Sender){

    Label4->Caption = "";

    // ""void fastcall TForml::RadioButton2Click(TObject *Sender){

    Label4->Caption = "";

    , . 1.5, - checkBox.

    Label! :Che:kBox1 CheckBox2 CheckBox3 CheckBox4

    Buttoni

    -

    -

    I::

    . 1.5.

    float surnm; //

    // fastcall TForml::TForml(TComponent* Owner)

    : TForm(Owner)

  • f

    // ""CheckBox2->Enabled = false;

    // "-"void fastcall TFoml: :CheckBoxlClick(TObject *Sender){

    if ( CheckBoxl->Checked ){

    /* , */

    summ += 54;

    // ""CheckBox2->Enabled = true;

    }