Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- namespace aaaa {
- 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;
- /// <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;
- }
- }
- private: System::Windows::Forms::ProgressBar^ progressBar1;
- 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::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->progressBar1 = (gcnew System::Windows::Forms::ProgressBar());
- 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->SuspendLayout();
- //
- // progressBar1
- //
- this->progressBar1->Location = System::Drawing::Point(12, 238);
- this->progressBar1->Name = L"progressBar1";
- this->progressBar1->Size = System::Drawing::Size(268, 23);
- this->progressBar1->TabIndex = 0;
- //
- // 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(67, 118);
- 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(110, 118);
- this->label2->Name = L"label2";
- this->label2->Size = System::Drawing::Size(26, 38);
- this->label2->TabIndex = 2;
- this->label2->Text = L":";
- //
- // 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(126, 118);
- 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(169, 118);
- 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(185, 118);
- 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);
- //
- // Form1
- //
- this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
- this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
- this->ClientSize = System::Drawing::Size(292, 273);
- this->Controls->Add(this->SS);
- this->Controls->Add(this->label1);
- this->Controls->Add(this->MM);
- this->Controls->Add(this->label2);
- this->Controls->Add(this->HH);
- this->Controls->Add(this->progressBar1);
- this->Name = L"Form1";
- this->Text = L"Form1";
- this->ResumeLayout(false);
- this->PerformLayout();
- //Ustawienie czasu
- 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) {
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement