Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- namespace Project1 {
- using namespace System;
- using namespace System::ComponentModel;
- using namespace System::Collections;
- using namespace System::Windows::Forms;
- using namespace System::Data;
- using namespace System::Drawing;
- /// <summary>
- /// Summary for MyForm
- /// </summary>
- public ref class MyForm : public System::Windows::Forms::Form
- {
- public:
- MyForm(void)
- {
- InitializeComponent();
- //
- //TODO: Add the constructor code here
- //
- }
- protected:
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- ~MyForm()
- {
- if (components)
- {
- delete components;
- }
- }
- private: System::Windows::Forms::TextBox^ text_sm;
- private: System::Windows::Forms::TextBox^ text_dm;
- private: System::Windows::Forms::TextBox^ text_m;
- protected:
- private: System::Windows::Forms::Label^ label1;
- private: System::Windows::Forms::Label^ label2;
- private: System::Windows::Forms::Label^ label3;
- private: System::Windows::Forms::Label^ label4;
- private: System::Windows::Forms::TextBox^ gr;
- private: System::Windows::Forms::TextBox^ kg;
- private: System::Windows::Forms::TextBox^ tn;
- private: System::Windows::Forms::Label^ label5;
- private: System::Windows::Forms::Label^ label6;
- private: System::Windows::Forms::TextBox^ sek;
- private: System::Windows::Forms::TextBox^ min;
- private: System::Windows::Forms::TextBox^ hours;
- private: System::Windows::Forms::Label^ label7;
- private: System::Windows::Forms::Label^ label8;
- private: System::Windows::Forms::Label^ label9;
- private: System::Windows::Forms::Label^ label10;
- private: System::Windows::Forms::Label^ label11;
- private: System::Windows::Forms::Label^ label12;
- private: System::Windows::Forms::TextBox^ grivn;
- private: System::Windows::Forms::TextBox^ dollar;
- private: System::Windows::Forms::TextBox^ evro;
- protected:
- protected:
- private:
- /// <summary>
- /// Required designer variable.
- /// </summary>
- System::ComponentModel::Container ^components;
- #pragma region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- void InitializeComponent(void)
- {
- this->text_sm = (gcnew System::Windows::Forms::TextBox());
- this->text_dm = (gcnew System::Windows::Forms::TextBox());
- this->text_m = (gcnew System::Windows::Forms::TextBox());
- this->label1 = (gcnew System::Windows::Forms::Label());
- this->label2 = (gcnew System::Windows::Forms::Label());
- this->label3 = (gcnew System::Windows::Forms::Label());
- this->label4 = (gcnew System::Windows::Forms::Label());
- this->gr = (gcnew System::Windows::Forms::TextBox());
- this->kg = (gcnew System::Windows::Forms::TextBox());
- this->tn = (gcnew System::Windows::Forms::TextBox());
- this->label5 = (gcnew System::Windows::Forms::Label());
- this->label6 = (gcnew System::Windows::Forms::Label());
- this->sek = (gcnew System::Windows::Forms::TextBox());
- this->min = (gcnew System::Windows::Forms::TextBox());
- this->hours = (gcnew System::Windows::Forms::TextBox());
- this->label7 = (gcnew System::Windows::Forms::Label());
- this->label8 = (gcnew System::Windows::Forms::Label());
- this->label9 = (gcnew System::Windows::Forms::Label());
- this->label10 = (gcnew System::Windows::Forms::Label());
- this->label11 = (gcnew System::Windows::Forms::Label());
- this->label12 = (gcnew System::Windows::Forms::Label());
- this->grivn = (gcnew System::Windows::Forms::TextBox());
- this->dollar = (gcnew System::Windows::Forms::TextBox());
- this->evro = (gcnew System::Windows::Forms::TextBox());
- this->SuspendLayout();
- //
- // text_sm
- //
- this->text_sm->Location = System::Drawing::Point(45, 44);
- this->text_sm->Name = L"text_sm";
- this->text_sm->Size = System::Drawing::Size(100, 20);
- this->text_sm->TabIndex = 0;
- this->text_sm->TextChanged += gcnew System::EventHandler(this, &MyForm::sm_changed);
- this->text_sm->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &MyForm::sm_keypressed);
- //
- // text_dm
- //
- this->text_dm->Location = System::Drawing::Point(151, 44);
- this->text_dm->Name = L"text_dm";
- this->text_dm->Size = System::Drawing::Size(100, 20);
- this->text_dm->TabIndex = 0;
- this->text_dm->TextChanged += gcnew System::EventHandler(this, &MyForm::change_dm);
- this->text_dm->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &MyForm::dm_keypressed);
- //
- // text_m
- //
- this->text_m->Location = System::Drawing::Point(257, 44);
- this->text_m->Name = L"text_m";
- this->text_m->Size = System::Drawing::Size(100, 20);
- this->text_m->TabIndex = 0;
- this->text_m->TextChanged += gcnew System::EventHandler(this, &MyForm::change_sm_dm);
- this->text_m->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &MyForm::m_key_pressed);
- //
- // label1
- //
- this->label1->AutoSize = true;
- this->label1->Location = System::Drawing::Point(45, 25);
- this->label1->Name = L"label1";
- this->label1->Size = System::Drawing::Size(70, 13);
- this->label1->TabIndex = 1;
- this->label1->Text = L"Сантиметры";
- this->label1->Click += gcnew System::EventHandler(this, &MyForm::label1_Click);
- //
- // label2
- //
- this->label2->AutoSize = true;
- this->label2->Location = System::Drawing::Point(148, 25);
- this->label2->Name = L"label2";
- this->label2->Size = System::Drawing::Size(67, 13);
- this->label2->TabIndex = 1;
- this->label2->Text = L"Дециметры";
- this->label2->Click += gcnew System::EventHandler(this, &MyForm::label1_Click);
- //
- // label3
- //
- this->label3->AutoSize = true;
- this->label3->Location = System::Drawing::Point(254, 25);
- this->label3->Name = L"label3";
- this->label3->Size = System::Drawing::Size(41, 13);
- this->label3->TabIndex = 1;
- this->label3->Text = L"Метры";
- this->label3->Click += gcnew System::EventHandler(this, &MyForm::label1_Click);
- //
- // label4
- //
- this->label4->AutoSize = true;
- this->label4->Location = System::Drawing::Point(45, 81);
- this->label4->Name = L"label4";
- this->label4->Size = System::Drawing::Size(49, 13);
- this->label4->TabIndex = 2;
- this->label4->Text = L"Граммы";
- //
- // gr
- //
- this->gr->Location = System::Drawing::Point(45, 98);
- this->gr->Name = L"gr";
- this->gr->Size = System::Drawing::Size(100, 20);
- this->gr->TabIndex = 3;
- this->gr->TextChanged += gcnew System::EventHandler(this, &MyForm::gr_TextChanged);
- this->gr->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &MyForm::gr_keyPressed);
- //
- // kg
- //
- this->kg->Location = System::Drawing::Point(151, 98);
- this->kg->Name = L"kg";
- this->kg->Size = System::Drawing::Size(100, 20);
- this->kg->TabIndex = 3;
- this->kg->TextChanged += gcnew System::EventHandler(this, &MyForm::kg_TextChanged);
- this->kg->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &MyForm::kg_keyPressed);
- //
- // tn
- //
- this->tn->Location = System::Drawing::Point(257, 98);
- this->tn->Name = L"tn";
- this->tn->Size = System::Drawing::Size(100, 20);
- this->tn->TabIndex = 3;
- this->tn->TextChanged += gcnew System::EventHandler(this, &MyForm::tn_changed);
- this->tn->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &MyForm::tn_keyPressed);
- //
- // label5
- //
- this->label5->AutoSize = true;
- this->label5->Location = System::Drawing::Point(148, 82);
- this->label5->Name = L"label5";
- this->label5->Size = System::Drawing::Size(73, 13);
- this->label5->TabIndex = 2;
- this->label5->Text = L"Килограммы";
- //
- // label6
- //
- this->label6->AutoSize = true;
- this->label6->Location = System::Drawing::Point(254, 82);
- this->label6->Name = L"label6";
- this->label6->Size = System::Drawing::Size(40, 13);
- this->label6->TabIndex = 2;
- this->label6->Text = L"Тонны";
- //
- // sek
- //
- this->sek->Location = System::Drawing::Point(45, 155);
- this->sek->Name = L"sek";
- this->sek->Size = System::Drawing::Size(100, 20);
- this->sek->TabIndex = 4;
- this->sek->TextChanged += gcnew System::EventHandler(this, &MyForm::sek_TextChanged);
- this->sek->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &MyForm::sek_keypressed);
- //
- // min
- //
- this->min->Location = System::Drawing::Point(151, 155);
- this->min->Name = L"min";
- this->min->Size = System::Drawing::Size(100, 20);
- this->min->TabIndex = 4;
- this->min->TextChanged += gcnew System::EventHandler(this, &MyForm::mins_changed);
- this->min->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &MyForm::mins_pressed);
- //
- // hours
- //
- this->hours->Location = System::Drawing::Point(257, 155);
- this->hours->Name = L"hours";
- this->hours->Size = System::Drawing::Size(100, 20);
- this->hours->TabIndex = 4;
- this->hours->TextChanged += gcnew System::EventHandler(this, &MyForm::hours_changed);
- this->hours->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &MyForm::hours_keypressed);
- //
- // label7
- //
- this->label7->AutoSize = true;
- this->label7->Location = System::Drawing::Point(42, 133);
- this->label7->Name = L"label7";
- this->label7->Size = System::Drawing::Size(51, 13);
- this->label7->TabIndex = 5;
- this->label7->Text = L"Секунды";
- this->label7->Click += gcnew System::EventHandler(this, &MyForm::label7_Click);
- //
- // label8
- //
- this->label8->AutoSize = true;
- this->label8->Location = System::Drawing::Point(148, 133);
- this->label8->Name = L"label8";
- this->label8->Size = System::Drawing::Size(46, 13);
- this->label8->TabIndex = 5;
- this->label8->Text = L"Минуты";
- //
- // label9
- //
- this->label9->AutoSize = true;
- this->label9->Location = System::Drawing::Point(254, 133);
- this->label9->Name = L"label9";
- this->label9->Size = System::Drawing::Size(35, 13);
- this->label9->TabIndex = 5;
- this->label9->Text = L"Часы";
- //
- // label10
- //
- this->label10->AutoSize = true;
- this->label10->Location = System::Drawing::Point(48, 187);
- this->label10->Name = L"label10";
- this->label10->Size = System::Drawing::Size(45, 13);
- this->label10->TabIndex = 6;
- this->label10->Text = L"Гривны";
- this->label10->Click += gcnew System::EventHandler(this, &MyForm::label10_Click);
- //
- // label11
- //
- this->label11->AutoSize = true;
- this->label11->Location = System::Drawing::Point(148, 187);
- this->label11->Name = L"label11";
- this->label11->Size = System::Drawing::Size(54, 13);
- this->label11->TabIndex = 6;
- this->label11->Text = L"Доллары";
- //
- // label12
- //
- this->label12->AutoSize = true;
- this->label12->Location = System::Drawing::Point(254, 187);
- this->label12->Name = L"label12";
- this->label12->Size = System::Drawing::Size(32, 13);
- this->label12->TabIndex = 6;
- this->label12->Text = L"Евро";
- //
- // grivn
- //
- this->grivn->Location = System::Drawing::Point(45, 204);
- this->grivn->Name = L"grivn";
- this->grivn->Size = System::Drawing::Size(100, 20);
- this->grivn->TabIndex = 7;
- this->grivn->TextChanged += gcnew System::EventHandler(this, &MyForm::grivn_changed);
- this->grivn->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &MyForm::grivn_pressed);
- //
- // dollar
- //
- this->dollar->Location = System::Drawing::Point(151, 203);
- this->dollar->Name = L"dollar";
- this->dollar->Size = System::Drawing::Size(100, 20);
- this->dollar->TabIndex = 7;
- this->dollar->TextChanged += gcnew System::EventHandler(this, &MyForm::dollar_changed);
- this->dollar->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &MyForm::dollar_preeed);
- //
- // evro
- //
- this->evro->Location = System::Drawing::Point(257, 203);
- this->evro->Name = L"evro";
- this->evro->Size = System::Drawing::Size(100, 20);
- this->evro->TabIndex = 7;
- this->evro->TextChanged += gcnew System::EventHandler(this, &MyForm::evro_changed);
- this->evro->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &MyForm::evro_pressed);
- //
- // MyForm
- //
- this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
- this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
- this->ClientSize = System::Drawing::Size(405, 258);
- this->Controls->Add(this->evro);
- this->Controls->Add(this->dollar);
- this->Controls->Add(this->grivn);
- this->Controls->Add(this->label12);
- this->Controls->Add(this->label11);
- this->Controls->Add(this->label10);
- this->Controls->Add(this->label9);
- this->Controls->Add(this->label8);
- this->Controls->Add(this->label7);
- this->Controls->Add(this->hours);
- this->Controls->Add(this->min);
- this->Controls->Add(this->sek);
- this->Controls->Add(this->tn);
- this->Controls->Add(this->kg);
- this->Controls->Add(this->gr);
- this->Controls->Add(this->label6);
- this->Controls->Add(this->label5);
- this->Controls->Add(this->label4);
- this->Controls->Add(this->label3);
- this->Controls->Add(this->label2);
- this->Controls->Add(this->label1);
- this->Controls->Add(this->text_m);
- this->Controls->Add(this->text_dm);
- this->Controls->Add(this->text_sm);
- this->Name = L"MyForm";
- this->Text = L"Конвертер";
- this->Load += gcnew System::EventHandler(this, &MyForm::MyForm_Load);
- this->ResumeLayout(false);
- this->PerformLayout();
- }
- #pragma endregion
- private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) {
- }
- Boolean m_keyPressed = false;
- Boolean sm_keyPressed = false;
- Boolean dm_keyPressed = false;
- Boolean gr_keyPressedflag = false;
- Boolean kg_keyPressedflag = false;
- Boolean tn_keyPressedflag = false;
- Boolean min_keyPressedflag = false;
- Boolean sek_keyPressedflag = false;
- Boolean hour_keyPressedflag = false;
- Boolean grivn_keyPressedflag = false;
- Boolean dollar_keyPressedflag = false;
- Boolean evro_keyPressedflag = false;
- private: System::Void change_sm_dm(System::Object^ sender, System::EventArgs^ e) {
- if (m_keyPressed) {
- m_keyPressed = false;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- if (text_m->Text != ""){
- if (text_m->Text->IndexOf(TorZ) != text_m->Text->Length - 1){
- text_sm->Text = Convert::ToString(Convert::ToDouble((text_m->Text)) * 100);
- text_dm->Text = Convert::ToString(Convert::ToDouble((text_m->Text)) * 10);
- }
- }
- else
- {
- text_sm->Text = "0";
- text_dm->Text = "0";
- }
- }
- }
- private: System::Void m_key_pressed(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e) {
- // Выясняем что установлено в настройках в качестве разделителя
- // точка или запятая
- m_keyPressed = true;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- bool TZFound = false; // Разделительный знак найден
- if (Char::IsDigit(e->KeyChar) == true) return;
- if (e->KeyChar == (char)Keys::Back) return;
- if (text_m->Text->IndexOf(TorZ) != -1)
- TZFound = true;
- if (TZFound == true) { e->Handled = true; return; }
- if (e->KeyChar.ToString() == TorZ) return;
- e->Handled = true;
- }
- private: System::Void change_dm(System::Object^ sender, System::EventArgs^ e) {
- if (dm_keyPressed) {
- dm_keyPressed = false;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- if (text_dm->Text != ""){
- if (text_dm->Text->IndexOf(TorZ) != text_dm->Text->Length - 1){
- text_m->Text = Convert::ToString(Convert::ToDouble((text_dm->Text)) / 10);
- text_sm->Text = Convert::ToString(Convert::ToDouble((text_dm->Text)) * 10);
- }
- }
- else
- {
- text_m->Text = "0";
- text_sm->Text = "0";
- }
- }
- }
- private: System::Void dm_keypressed(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e) {
- // Выясняем что установлено в настройках в качестве разделителя
- // точка или запятая
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- dm_keyPressed = true;
- bool TZFound = false; // Разделительный знак найден
- if (Char::IsDigit(e->KeyChar) == true) return;
- if (e->KeyChar == (char)Keys::Back) return;
- if (text_dm->Text->IndexOf(TorZ) != -1)
- TZFound = true;
- if (TZFound == true) { e->Handled = true; return; }
- if (e->KeyChar.ToString() == TorZ) return;
- e->Handled = true;
- }
- private: System::Void sm_changed(System::Object^ sender, System::EventArgs^ e) {
- if (sm_keyPressed) {
- sm_keyPressed = false;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- if (text_sm->Text != ""){
- if (text_sm->Text->IndexOf(TorZ) != text_sm->Text->Length - 1){
- text_m->Text = Convert::ToString(Convert::ToDouble((text_sm->Text)) / 100);
- text_dm->Text = Convert::ToString(Convert::ToDouble((text_sm->Text)) / 10);
- }
- }
- else
- {
- text_m->Text = "0";
- text_dm->Text = "0";
- }
- }
- }
- private: System::Void sm_keypressed(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e) {
- // Выясняем что установлено в настройках в качестве разделителя
- // точка или запятая
- sm_keyPressed = true;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- bool TZFound = false; // Разделительный знак найден
- if (Char::IsDigit(e->KeyChar) == true) return;
- if (e->KeyChar == (char)Keys::Back) return;
- if (text_sm->Text->IndexOf(TorZ) != -1)
- TZFound = true;
- if (TZFound == true) { e->Handled = true; return; }
- if (e->KeyChar.ToString() == TorZ) return;
- e->Handled = true;
- }
- private: System::Void tn_changed(System::Object^ sender, System::EventArgs^ e) {
- if (tn_keyPressedflag) {
- tn_keyPressedflag = false;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- if (tn->Text != ""){
- if (tn->Text->IndexOf(TorZ) != tn->Text->Length - 1){
- kg->Text = Convert::ToString(Convert::ToDouble((tn->Text)) * 1000);
- gr->Text = Convert::ToString(Convert::ToDouble((tn->Text)) * 1000000);
- }
- }
- else
- {
- kg->Text = "0";
- gr->Text = "0";
- }
- }
- }
- private: System::Void tn_keyPressed(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e) {
- // Выясняем что установлено в настройках в качестве разделителя
- // точка или запятая
- tn_keyPressedflag = true;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- bool TZFound = false; // Разделительный знак найден
- if (Char::IsDigit(e->KeyChar) == true) return;
- if (e->KeyChar == (char)Keys::Back) return;
- if (tn->Text->IndexOf(TorZ) != -1)
- TZFound = true;
- if (TZFound == true) { e->Handled = true; return; }
- if (e->KeyChar.ToString() == TorZ) return;
- e->Handled = true;
- }
- private: System::Void kg_TextChanged(System::Object^ sender, System::EventArgs^ e) {
- if (kg_keyPressedflag) {
- kg_keyPressedflag = false;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- if (kg->Text != ""){
- if (kg->Text->IndexOf(TorZ) != kg->Text->Length - 1){
- tn->Text = Convert::ToString(Convert::ToDouble((kg->Text)) / 1000);
- gr->Text = Convert::ToString(Convert::ToDouble((kg->Text)) * 1000);
- }
- }
- else
- {
- tn->Text = "0";
- gr->Text = "0";
- }
- }
- }
- private: System::Void kg_keyPressed(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e) {
- // Выясняем что установлено в настройках в качестве разделителя
- // точка или запятая
- kg_keyPressedflag = true;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- bool TZFound = false; // Разделительный знак найден
- if (Char::IsDigit(e->KeyChar) == true) return;
- if (e->KeyChar == (char)Keys::Back) return;
- if (kg->Text->IndexOf(TorZ) != -1)
- TZFound = true;
- if (TZFound == true) { e->Handled = true; return; }
- if (e->KeyChar.ToString() == TorZ) return;
- e->Handled = true;
- }
- private: System::Void gr_TextChanged(System::Object^ sender, System::EventArgs^ e) {
- if (gr_keyPressedflag) {
- gr_keyPressedflag = false;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- if (gr->Text != ""){
- if (gr->Text->IndexOf(TorZ) != gr->Text->Length - 1){
- tn->Text = Convert::ToString(Convert::ToDouble((gr->Text)) / 1000000);
- kg->Text = Convert::ToString(Convert::ToDouble((gr->Text)) / 1000);
- }
- }
- else
- {
- tn->Text = "0";
- kg->Text = "0";
- }
- }
- }
- private: System::Void gr_keyPressed(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e) {
- // Выясняем что установлено в настройках в качестве разделителя
- // точка или запятая
- gr_keyPressedflag = true;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- bool TZFound = false; // Разделительный знак найден
- if (Char::IsDigit(e->KeyChar) == true) return;
- if (e->KeyChar == (char)Keys::Back) return;
- if (gr->Text->IndexOf(TorZ) != -1)
- TZFound = true;
- if (TZFound == true) { e->Handled = true; return; }
- if (e->KeyChar.ToString() == TorZ) return;
- e->Handled = true;
- }
- private: System::Void MyForm_Load(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void label7_Click(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void hours_changed(System::Object^ sender, System::EventArgs^ e) {
- if (hour_keyPressedflag) {
- hour_keyPressedflag = false;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- if (hours->Text != ""){
- if (hours->Text->IndexOf(TorZ) != hours->Text->Length - 1){
- min->Text = Convert::ToString(Convert::ToDouble((hours->Text)) *60);
- sek->Text = Convert::ToString(Convert::ToDouble((hours->Text)) *3600);
- }
- }
- else
- {
- min->Text = "0";
- sek->Text = "0";
- }
- }
- }
- private: System::Void hours_keypressed(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e) {
- // Выясняем что установлено в настройках в качестве разделителя
- // точка или запятая
- hour_keyPressedflag = true;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- bool TZFound = false; // Разделительный знак найден
- if (Char::IsDigit(e->KeyChar) == true) return;
- if (e->KeyChar == (char)Keys::Back) return;
- if (hours->Text->IndexOf(TorZ) != -1)
- TZFound = true;
- if (TZFound == true) { e->Handled = true; return; }
- if (e->KeyChar.ToString() == TorZ) return;
- e->Handled = true;
- }
- private: System::Void mins_changed(System::Object^ sender, System::EventArgs^ e) {
- if (min_keyPressedflag) {
- min_keyPressedflag = false;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- if (min->Text != ""){
- if (min->Text->IndexOf(TorZ) != min->Text->Length - 1){
- hours->Text = Convert::ToString(Convert::ToDouble((min->Text)) / 60);
- sek->Text = Convert::ToString(Convert::ToDouble((min->Text)) * 60);
- }
- }
- else
- {
- hours->Text = "0";
- sek->Text = "0";
- }
- }
- }
- private: System::Void mins_pressed(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e) {
- // Выясняем что установлено в настройках в качестве разделителя
- // точка или запятая
- min_keyPressedflag = true;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- bool TZFound = false; // Разделительный знак найден
- if (Char::IsDigit(e->KeyChar) == true) return;
- if (e->KeyChar == (char)Keys::Back) return;
- if (min->Text->IndexOf(TorZ) != -1)
- TZFound = true;
- if (TZFound == true) { e->Handled = true; return; }
- if (e->KeyChar.ToString() == TorZ) return;
- e->Handled = true;
- }
- private: System::Void sek_TextChanged(System::Object^ sender, System::EventArgs^ e) {
- if (sek_keyPressedflag) {
- sek_keyPressedflag = false;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- if (sek->Text != ""){
- if (sek->Text->IndexOf(TorZ) != sek->Text->Length - 1){
- hours->Text = Convert::ToString(Convert::ToDouble((sek->Text)) / 3600);
- min->Text = Convert::ToString(Convert::ToDouble((sek->Text)) / 60);
- }
- }
- else
- {
- hours->Text = "0";
- min->Text = "0";
- }
- }
- }
- private: System::Void sek_keypressed(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e) {
- // Выясняем что установлено в настройках в качестве разделителя
- // точка или запятая
- sek_keyPressedflag = true;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- bool TZFound = false; // Разделительный знак найден
- if (Char::IsDigit(e->KeyChar) == true) return;
- if (e->KeyChar == (char)Keys::Back) return;
- if (sek->Text->IndexOf(TorZ) != -1)
- TZFound = true;
- if (TZFound == true) { e->Handled = true; return; }
- if (e->KeyChar.ToString() == TorZ) return;
- e->Handled = true;
- }
- private: System::Void label10_Click(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void grivn_changed(System::Object^ sender, System::EventArgs^ e) {
- if (grivn_keyPressedflag) {
- grivn_keyPressedflag = false;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- if (grivn->Text != ""){
- if (grivn->Text->IndexOf(TorZ) != grivn->Text->Length - 1){
- dollar->Text = Convert::ToString(Convert::ToDouble((grivn->Text)) /16);
- evro->Text = Convert::ToString(Convert::ToDouble((grivn->Text)) /19 );
- }
- }
- else
- {
- dollar->Text = "0";
- evro->Text = "0";
- }
- }
- }
- private: System::Void grivn_pressed(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e) {
- // Выясняем что установлено в настройках в качестве разделителя
- // точка или запятая
- grivn_keyPressedflag = true;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- bool TZFound = false; // Разделительный знак найден
- if (Char::IsDigit(e->KeyChar) == true) return;
- if (e->KeyChar == (char)Keys::Back) return;
- if (grivn->Text->IndexOf(TorZ) != -1)
- TZFound = true;
- if (TZFound == true) { e->Handled = true; return; }
- if (e->KeyChar.ToString() == TorZ) return;
- e->Handled = true;
- }
- private: System::Void dollar_changed(System::Object^ sender, System::EventArgs^ e) {
- if (dollar_keyPressedflag) {
- dollar_keyPressedflag = false;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- if (dollar->Text != ""){
- if (dollar->Text->IndexOf(TorZ) != dollar->Text->Length - 1){
- grivn->Text = Convert::ToString(Convert::ToDouble((dollar->Text)) * 16);
- evro->Text = Convert::ToString(Convert::ToDouble((dollar->Text)) * 0.8035);
- }
- }
- else
- {
- grivn->Text = "0";
- evro->Text = "0";
- }
- }
- }
- private: System::Void dollar_preeed(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e) {
- // Выясняем что установлено в настройках в качестве разделителя
- // точка или запятая
- dollar_keyPressedflag = true;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- bool TZFound = false; // Разделительный знак найден
- if (Char::IsDigit(e->KeyChar) == true) return;
- if (e->KeyChar == (char)Keys::Back) return;
- if (dollar->Text->IndexOf(TorZ) != -1)
- TZFound = true;
- if (TZFound == true) { e->Handled = true; return; }
- if (e->KeyChar.ToString() == TorZ) return;
- e->Handled = true;
- }
- private: System::Void evro_changed(System::Object^ sender, System::EventArgs^ e) {
- if (evro_keyPressedflag) {
- evro_keyPressedflag = false;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- if (evro->Text != ""){
- if (evro->Text->IndexOf(TorZ) != evro->Text->Length - 1){
- dollar->Text = Convert::ToString(Convert::ToDouble((evro->Text)) * 1.2445);
- grivn->Text = Convert::ToString(Convert::ToDouble((evro->Text)) * 19);
- }
- }
- else
- {
- dollar->Text = "0";
- grivn->Text = "0";
- }
- }
- }
- private: System::Void evro_pressed(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e) {
- // Выясняем что установлено в настройках в качестве разделителя
- // точка или запятая
- evro_keyPressedflag = true;
- String^ TorZ = Globalization::NumberFormatInfo::CurrentInfo->NumberDecimalSeparator; // Точка или запятая
- bool TZFound = false; // Разделительный знак найден
- if (Char::IsDigit(e->KeyChar) == true) return;
- if (e->KeyChar == (char)Keys::Back) return;
- if (evro->Text->IndexOf(TorZ) != -1)
- TZFound = true;
- if (TZFound == true) { e->Handled = true; return; }
- if (e->KeyChar.ToString() == TorZ) return;
- e->Handled = true;
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement