Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- namespace a {
- using namespace System;
- using namespace System::ComponentModel;
- using namespace System::Collections;
- using namespace System::Windows::Forms;
- using namespace System::Data;
- using namespace System::Drawing;
- int hours = 0;
- int minutes = 0;
- int seconds = 0;
- int stophours = 0;
- int stopminutes = 0;
- int stopseconds = 0;
- int stopmiliseconds = 0;
- int lastmiliseconds = 0;
- int lastseconds = 0;
- int terazmiliseconds = 0;
- int terazseconds = 0;
- /// <summary>
- /// Summary for Form1
- /// </summary>
- public ref class Form1 : public System::Windows::Forms::Form
- {
- public:
- Form1(void)
- {
- InitializeComponent();
- //
- //TODO: Add the constructor code here
- //
- }
- protected:
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- ~Form1()
- {
- if (components)
- {
- delete components;
- }
- }
- protected:
- private: System::Windows::Forms::Label^ HH;
- private: System::Windows::Forms::Label^ label2;
- private: System::Windows::Forms::Label^ MM;
- private: System::Windows::Forms::Label^ label1;
- private: System::Windows::Forms::Label^ SS;
- private: System::Windows::Forms::Timer^ timer1;
- private: System::Windows::Forms::GroupBox^ groupBox1;
- private: System::Windows::Forms::Label^ Stoper;
- private: System::Windows::Forms::GroupBox^ groupBox2;
- private: System::Windows::Forms::Button^ button1;
- private: System::Windows::Forms::Timer^ timer2;
- private: System::Windows::Forms::GroupBox^ groupBox3;
- private: System::Windows::Forms::GroupBox^ groupBox4;
- private: System::Windows::Forms::Label^ wzgledny3;
- private: System::Windows::Forms::Label^ wzgledny1;
- private: System::Windows::Forms::Label^ wzgledny2;
- private: System::Windows::Forms::Label^ miedzyczas3;
- private: System::Windows::Forms::Label^ miedzyczas2;
- private: System::Windows::Forms::Label^ miedzyczas1;
- private: System::ComponentModel::IContainer^ components;
- private:
- /// <summary>
- /// Required designer variable.
- /// </summary>
- #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->components = (gcnew System::ComponentModel::Container());
- this->HH = (gcnew System::Windows::Forms::Label());
- this->label2 = (gcnew System::Windows::Forms::Label());
- this->MM = (gcnew System::Windows::Forms::Label());
- this->label1 = (gcnew System::Windows::Forms::Label());
- this->SS = (gcnew System::Windows::Forms::Label());
- this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
- this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
- this->Stoper = (gcnew System::Windows::Forms::Label());
- this->groupBox2 = (gcnew System::Windows::Forms::GroupBox());
- this->groupBox4 = (gcnew System::Windows::Forms::GroupBox());
- this->wzgledny3 = (gcnew System::Windows::Forms::Label());
- this->wzgledny1 = (gcnew System::Windows::Forms::Label());
- this->wzgledny2 = (gcnew System::Windows::Forms::Label());
- this->groupBox3 = (gcnew System::Windows::Forms::GroupBox());
- this->miedzyczas3 = (gcnew System::Windows::Forms::Label());
- this->miedzyczas2 = (gcnew System::Windows::Forms::Label());
- this->miedzyczas1 = (gcnew System::Windows::Forms::Label());
- this->button1 = (gcnew System::Windows::Forms::Button());
- this->timer2 = (gcnew System::Windows::Forms::Timer(this->components));
- this->groupBox1->SuspendLayout();
- this->groupBox2->SuspendLayout();
- this->groupBox4->SuspendLayout();
- this->groupBox3->SuspendLayout();
- this->SuspendLayout();
- //
- // HH
- //
- this->HH->AutoSize = true;
- this->HH->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 24.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(238)));
- this->HH->Location = System::Drawing::Point(6, 16);
- this->HH->Name = L"HH";
- this->HH->Size = System::Drawing::Size(53, 38);
- this->HH->TabIndex = 1;
- this->HH->Text = L"00";
- //
- // label2
- //
- this->label2->AutoSize = true;
- this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 24.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(238)));
- this->label2->Location = System::Drawing::Point(50, 16);
- this->label2->Name = L"label2";
- this->label2->Size = System::Drawing::Size(26, 38);
- this->label2->TabIndex = 2;
- this->label2->Text = L":";
- this->label2->Click += gcnew System::EventHandler(this, &Form1::label2_Click);
- //
- // MM
- //
- this->MM->AutoSize = true;
- this->MM->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 24.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(238)));
- this->MM->Location = System::Drawing::Point(68, 16);
- this->MM->Name = L"MM";
- this->MM->Size = System::Drawing::Size(53, 38);
- this->MM->TabIndex = 3;
- this->MM->Text = L"00";
- this->MM->Click += gcnew System::EventHandler(this, &Form1::MM_Click);
- //
- // label1
- //
- this->label1->AutoSize = true;
- this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 24.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(238)));
- this->label1->Location = System::Drawing::Point(113, 16);
- this->label1->Name = L"label1";
- this->label1->Size = System::Drawing::Size(26, 38);
- this->label1->TabIndex = 4;
- this->label1->Text = L":";
- //
- // SS
- //
- this->SS->AutoSize = true;
- this->SS->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 24.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(238)));
- this->SS->Location = System::Drawing::Point(127, 16);
- this->SS->Name = L"SS";
- this->SS->Size = System::Drawing::Size(53, 38);
- this->SS->TabIndex = 5;
- this->SS->Text = L"00";
- //
- // timer1
- //
- this->timer1->Enabled = true;
- this->timer1->Interval = 1000;
- this->timer1->Tick += gcnew System::EventHandler(this, &Form1::timer1_Tick);
- //
- // groupBox1
- //
- this->groupBox1->Controls->Add(this->HH);
- this->groupBox1->Controls->Add(this->SS);
- this->groupBox1->Controls->Add(this->label2);
- this->groupBox1->Controls->Add(this->MM);
- this->groupBox1->Controls->Add(this->label1);
- this->groupBox1->Location = System::Drawing::Point(342, 12);
- this->groupBox1->Name = L"groupBox1";
- this->groupBox1->Size = System::Drawing::Size(186, 64);
- this->groupBox1->TabIndex = 6;
- this->groupBox1->TabStop = false;
- this->groupBox1->Text = L"Zegar";
- this->groupBox1->Enter += gcnew System::EventHandler(this, &Form1::groupBox1_Enter);
- //
- // Stoper
- //
- this->Stoper->AutoSize = true;
- this->Stoper->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 24.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(238)));
- this->Stoper->Location = System::Drawing::Point(114, 15);
- this->Stoper->Name = L"Stoper";
- this->Stoper->RightToLeft = System::Windows::Forms::RightToLeft::Yes;
- this->Stoper->Size = System::Drawing::Size(80, 38);
- this->Stoper->TabIndex = 7;
- this->Stoper->Text = L"0.00";
- this->Stoper->TextAlign = System::Drawing::ContentAlignment::TopRight;
- this->Stoper->Click += gcnew System::EventHandler(this, &Form1::Stoper_Click);
- //
- // groupBox2
- //
- this->groupBox2->Controls->Add(this->groupBox4);
- this->groupBox2->Controls->Add(this->Stoper);
- this->groupBox2->Controls->Add(this->groupBox3);
- this->groupBox2->Controls->Add(this->button1);
- this->groupBox2->Location = System::Drawing::Point(12, 12);
- this->groupBox2->Name = L"groupBox2";
- this->groupBox2->Size = System::Drawing::Size(325, 176);
- this->groupBox2->TabIndex = 8;
- this->groupBox2->TabStop = false;
- this->groupBox2->Text = L"Stoper";
- this->groupBox2->Enter += gcnew System::EventHandler(this, &Form1::groupBox2_Enter);
- //
- // groupBox4
- //
- this->groupBox4->Controls->Add(this->wzgledny3);
- this->groupBox4->Controls->Add(this->wzgledny1);
- this->groupBox4->Controls->Add(this->wzgledny2);
- this->groupBox4->Location = System::Drawing::Point(178, 91);
- this->groupBox4->Name = L"groupBox4";
- this->groupBox4->Size = System::Drawing::Size(142, 79);
- this->groupBox4->TabIndex = 11;
- this->groupBox4->TabStop = false;
- this->groupBox4->Text = L"Czas względny";
- //
- // wzgledny3
- //
- this->wzgledny3->AutoSize = true;
- this->wzgledny3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(238)));
- this->wzgledny3->Location = System::Drawing::Point(6, 56);
- this->wzgledny3->Name = L"wzgledny3";
- this->wzgledny3->RightToLeft = System::Windows::Forms::RightToLeft::Yes;
- this->wzgledny3->Size = System::Drawing::Size(40, 20);
- this->wzgledny3->TabIndex = 5;
- this->wzgledny3->Text = L"0.00";
- this->wzgledny3->TextAlign = System::Drawing::ContentAlignment::TopRight;
- //
- // wzgledny1
- //
- this->wzgledny1->AutoSize = true;
- this->wzgledny1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(238)));
- this->wzgledny1->Location = System::Drawing::Point(6, 16);
- this->wzgledny1->Name = L"wzgledny1";
- this->wzgledny1->RightToLeft = System::Windows::Forms::RightToLeft::Yes;
- this->wzgledny1->Size = System::Drawing::Size(40, 20);
- this->wzgledny1->TabIndex = 3;
- this->wzgledny1->Text = L"0.00";
- this->wzgledny1->TextAlign = System::Drawing::ContentAlignment::TopRight;
- //
- // wzgledny2
- //
- this->wzgledny2->AutoSize = true;
- this->wzgledny2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(238)));
- this->wzgledny2->Location = System::Drawing::Point(6, 36);
- this->wzgledny2->Name = L"wzgledny2";
- this->wzgledny2->RightToLeft = System::Windows::Forms::RightToLeft::Yes;
- this->wzgledny2->Size = System::Drawing::Size(40, 20);
- this->wzgledny2->TabIndex = 4;
- this->wzgledny2->Text = L"0.00";
- this->wzgledny2->TextAlign = System::Drawing::ContentAlignment::TopRight;
- //
- // groupBox3
- //
- this->groupBox3->Controls->Add(this->miedzyczas3);
- this->groupBox3->Controls->Add(this->miedzyczas2);
- this->groupBox3->Controls->Add(this->miedzyczas1);
- this->groupBox3->Location = System::Drawing::Point(6, 91);
- this->groupBox3->Name = L"groupBox3";
- this->groupBox3->Size = System::Drawing::Size(166, 79);
- this->groupBox3->TabIndex = 10;
- this->groupBox3->TabStop = false;
- this->groupBox3->Text = L"Czasy zapisane";
- //
- // miedzyczas3
- //
- this->miedzyczas3->AutoSize = true;
- this->miedzyczas3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(238)));
- this->miedzyczas3->Location = System::Drawing::Point(6, 56);
- this->miedzyczas3->Name = L"miedzyczas3";
- this->miedzyczas3->RightToLeft = System::Windows::Forms::RightToLeft::Yes;
- this->miedzyczas3->Size = System::Drawing::Size(40, 20);
- this->miedzyczas3->TabIndex = 2;
- this->miedzyczas3->Text = L"0.00";
- this->miedzyczas3->TextAlign = System::Drawing::ContentAlignment::TopRight;
- //
- // miedzyczas2
- //
- this->miedzyczas2->AutoSize = true;
- this->miedzyczas2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(238)));
- this->miedzyczas2->Location = System::Drawing::Point(6, 36);
- this->miedzyczas2->Name = L"miedzyczas2";
- this->miedzyczas2->RightToLeft = System::Windows::Forms::RightToLeft::Yes;
- this->miedzyczas2->Size = System::Drawing::Size(40, 20);
- this->miedzyczas2->TabIndex = 1;
- this->miedzyczas2->Text = L"0.00";
- this->miedzyczas2->TextAlign = System::Drawing::ContentAlignment::TopRight;
- //
- // miedzyczas1
- //
- this->miedzyczas1->AutoSize = true;
- this->miedzyczas1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(238)));
- this->miedzyczas1->Location = System::Drawing::Point(6, 16);
- this->miedzyczas1->Name = L"miedzyczas1";
- this->miedzyczas1->RightToLeft = System::Windows::Forms::RightToLeft::Yes;
- this->miedzyczas1->Size = System::Drawing::Size(40, 20);
- this->miedzyczas1->TabIndex = 0;
- this->miedzyczas1->Text = L"0.00";
- this->miedzyczas1->TextAlign = System::Drawing::ContentAlignment::TopRight;
- //
- // button1
- //
- this->button1->Location = System::Drawing::Point(114, 56);
- this->button1->Name = L"button1";
- this->button1->Size = System::Drawing::Size(75, 23);
- this->button1->TabIndex = 9;
- this->button1->Text = L"Start";
- this->button1->UseVisualStyleBackColor = true;
- this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
- //
- // timer2
- //
- this->timer2->Interval = 10;
- this->timer2->Tick += gcnew System::EventHandler(this, &Form1::timer2_Tick);
- //
- // Form1
- //
- this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
- this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
- this->ClientSize = System::Drawing::Size(540, 191);
- this->Controls->Add(this->groupBox2);
- this->Controls->Add(this->groupBox1);
- this->Name = L"Form1";
- this->Text = L"Form1";
- this->groupBox1->ResumeLayout(false);
- this->groupBox1->PerformLayout();
- this->groupBox2->ResumeLayout(false);
- this->groupBox2->PerformLayout();
- this->groupBox4->ResumeLayout(false);
- this->groupBox4->PerformLayout();
- this->groupBox3->ResumeLayout(false);
- this->groupBox3->PerformLayout();
- this->ResumeLayout(false);
- /*DateTime czas = DateTime::Now;
- hours = czas.Hour;
- minutes = czas.Minute;
- seconds = czas.Second;
- if (System::Convert::ToString(hours)->Length==1)
- HH->Text="0"+System::Convert::ToString(hours);
- else
- HH->Text=System::Convert::ToString(hours);
- if (System::Convert::ToString(minutes)->Length==1)
- MM->Text="0"+System::Convert::ToString(minutes);
- else
- MM->Text=System::Convert::ToString(minutes);
- if (System::Convert::ToString(seconds)->Length==1)
- SS->Text="0"+System::Convert::ToString(seconds);
- else
- SS->Text=System::Convert::ToString(seconds);*/
- }
- #pragma endregion
- private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) {
- seconds ++;
- if (seconds>=60)
- {
- seconds = 0;
- minutes ++;
- }
- if (minutes>=60)
- {
- minutes = 0;
- hours ++;
- }
- if (hours>=24)
- {
- hours = 0;
- }
- if (System::Convert::ToString(hours)->Length==1)
- HH->Text="0"+System::Convert::ToString(hours);
- else
- HH->Text=System::Convert::ToString(hours);
- if (System::Convert::ToString(minutes)->Length==1)
- MM->Text="0"+System::Convert::ToString(minutes);
- else
- MM->Text=System::Convert::ToString(minutes);
- if (System::Convert::ToString(seconds)->Length==1)
- SS->Text="0"+System::Convert::ToString(seconds);
- else
- SS->Text=System::Convert::ToString(seconds);
- }
- private: System::Void MM_Click(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void label2_Click(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void groupBox1_Enter(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void Stoper_Click(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
- timer2->Enabled = true;
- button1->Text = "Zapisz";
- DateTime visualsuck = DateTime::Now;
- lastmiliseconds = visualsuck.Millisecond;
- lastseconds = visualsuck.Second;
- }
- private: System::Void groupBox2_Enter(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void timer2_Tick(System::Object^ sender, System::EventArgs^ e) {
- DateTime visualsuck= DateTime::Now;
- terazmiliseconds = visualsuck.Millisecond;
- terazseconds = visualsuck.Second;
- if (terazseconds>lastseconds)
- {
- stopmiliseconds=stopmiliseconds+(terazmiliseconds+1000)-lastmiliseconds;
- }
- else
- {
- stopmiliseconds=stopmiliseconds+terazmiliseconds-lastmiliseconds;
- }
- if (stopmiliseconds>=1000)
- {
- stopmiliseconds = stopmiliseconds-1000;
- stopseconds ++;
- }
- if (stopseconds>=60)
- {
- stopseconds = 0;
- stopminutes ++;
- }
- if (stopminutes>=60)
- {
- stopminutes = 0;
- stophours ++;
- }
- if (stophours>=24)
- {
- stophours = 0;
- }
- if (stopminutes>0)
- {
- if(stophours>0)
- {
- Stoper->Text = System::Convert::ToString(stophours)+":"+System::Convert::ToString(stopminutes)+":"+System::Convert::ToString(stopseconds)+"."+System::Convert::ToString(stopmiliseconds);
- }
- else
- {
- Stoper->Text = System::Convert::ToString(stopminutes)+":"+System::Convert::ToString(stopseconds)+"."+System::Convert::ToString(stopmiliseconds);
- }
- }
- else
- {
- Stoper->Text = System::Convert::ToString(stopseconds)+"."+System::Convert::ToString(stopmiliseconds);
- }
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement