Суббота, 18.05.2024, 20:31
Главная Регистрация RSS
Приветствую Вас, Гость
Меню сайта
Категории раздела
Форма входа
ДРУЗЬЯ САЙТА

Вызвать мастера в Красноярске

8 983 207 5474

8 902 918 9334

8 933 332 3164

---------------------------------

Запчасти бытткхники

  • Велес т.2935600
  • СЦ Близнецов т.2296595
  • Вираж
  • Красраб 110 т.2589503
  • Комплекстур Щорса30 т.2606797
  • Радиодетали

  • Якорный 9 т.2688317
  • Воронова 16 т.2202990
  • Красраб 125а т.2456544
  • Профи т.2702737
  • Дайте две т.+79237713323
  • Электрика

  • Электро +
  • Планета электрика
  • ЗАКЛАДКИ
    Поиск
    Статистика

    Онлайн всего: 1
    Гостей: 1
    Пользователей: 0
    Главная » Статьи » C++ Builder » Простые примеры

    C++ Builder XE2 реактивное сопротивление ёмкости расчет по формуле
    Практическое применение C++ Builder XE2 
    в радиолюбительской практике

    //---------------------------------------------------------------------------

    #include <vcl.h>
    #pragma hdrstop

    #include "Unit1.h"
    //---------------------------------------------------------------------------
    #pragma package(smart_init)
    #pragma resource "*.dfm"
    TForm1 *Form1;
    //---------------------------------------------------------------------------
    __fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
    {
    }
    //---------------------------------------------------------------------------
    /*
    Расчет по формуле Cx=1/(2*Pi*F*C) присвоение полученного значения 
    Label2
    */
    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
    if( Edit1->Text != "" && Edit2->Text != "" ){
    Label2->Caption=FloatToStr(
          1 / (2 * 3.14159 * 
          StrToFloat(Edit1->Text) * 
          StrToFloat(Edit2->Text) / 1000000 ) );
    }
    }
    //---------------------------------------------------------------------------
    /*
    Запрет контекстного меню в Edit1 
    */
    void __fastcall TForm1::Edit1ContextPopup(TObject *Sender, TPoint &MousePos, bool &Handled)

    {
    Handled=true;
    }
    //---------------------------------------------------------------------------
    /*
    Проверка вводимых символов: только цифры, запятая, забой
    */
    void __fastcall TForm1::Edit1KeyPress(TObject *Sender, System::WideChar &Key)
    {
    if( Key == ',' && Edit1->Text.Pos(",") > 0 ) { Key=0; return; }
    if(Key >= '0' && Key <= '9' || Key == VK_BACK || Key == ',') return;
    Key=0;
    }
    //---------------------------------------------------------------------------
    /*
    Запрет контекстного меню в Edit2 
    */
    void __fastcall TForm1::Edit2ContextPopup(TObject *Sender, TPoint &MousePos, bool &Handled)

    {
    Handled=true;
    }
    //---------------------------------------------------------------------------
    /*
    Проверка вводимых символов: только цифры, запятая, забой
    */
    void __fastcall TForm1::Edit2KeyPress(TObject *Sender, System::WideChar &Key)
    {
    if( Key == ',' && Edit2->Text.Pos(",") > 0 ) { Key=0; return; }
    if(Key >= '0' && Key <= '9' || Key == VK_BACK || Key == ',') return;
    Key=0;
    }
    //---------------------------------------------------------------------------
    /*
    Очистка 
    */
    void __fastcall TForm1::Button2Click(TObject *Sender)
    {
     Edit1->Text="";
     Edit2->Text="";
     Label2->Caption="";
    }
    //---------------------------------------------------------------------------

    Заголовочный файл
    //---------------------------------------------------------------------------

    #ifndef Unit1H
    #define Unit1H
    //---------------------------------------------------------------------------
    #include <System.Classes.hpp>
    #include <Vcl.Controls.hpp>
    #include <Vcl.StdCtrls.hpp>
    #include <Vcl.Forms.hpp>
    //---------------------------------------------------------------------------
    class TForm1 : public TForm
    {
    __published: // IDE-managed Components
    TLabel *Label1;
    TEdit *Edit1;
    TEdit *Edit2;
    TButton *Button1;
    TLabel *Label2;
    TLabel *Label3;
    TLabel *Label4;
    TLabel *Label5;
    TButton *Button2;
    void __fastcall Button1Click(TObject *Sender);
    void __fastcall Edit1ContextPopup(TObject *Sender, TPoint &MousePos, bool &Handled);
    void __fastcall Edit1KeyPress(TObject *Sender, System::WideChar &Key);
    void __fastcall Edit2ContextPopup(TObject *Sender, TPoint &MousePos, bool &Handled);
    void __fastcall Edit2KeyPress(TObject *Sender, System::WideChar &Key);
    void __fastcall Button2Click(TObject *Sender);


    private: // User declarations
    public: // User declarations
    __fastcall TForm1(TComponent* Owner);
    };
    //---------------------------------------------------------------------------
    extern PACKAGE TForm1 *Form1;
    //---------------------------------------------------------------------------
    #endif


    Категория: Простые примеры | Добавил: doka (09.03.2012)
    Просмотров: 2245 | Рейтинг: 0.0/0
    Добавлять комментарии могут только зарегистрированные пользователи.
    [ Регистрация | Вход ]