Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- namespace CppCLRWinformsProjekt {
- using namespace System;
- using namespace System::ComponentModel;
- using namespace System::Collections;
- using namespace System::Windows::Forms;
- using namespace System::Data;
- using namespace System::Drawing;
- static int price = 70000;
- static double base = 0;
- double value = 0;
- public ref class Form1 : public System::Windows::Forms::Form
- {
- public:
- Form1(void)
- {
- InitializeComponent();
- }
- protected:
- ~Form1()
- {
- if (components)
- {
- delete components;
- }
- }
- private: System::Windows::Forms::ComboBox^ comboBox1;
- protected:
- private: System::Windows::Forms::Label^ label1;
- private: System::Windows::Forms::TextBox^ textBox1;
- private: System::Windows::Forms::Label^ label2;
- private: System::Windows::Forms::CheckBox^ checkBox1;
- private: System::Windows::Forms::CheckBox^ checkBox2;
- private: System::Windows::Forms::CheckBox^ checkBox3;
- private: System::Windows::Forms::Label^ label3;
- private: System::Windows::Forms::Label^ label4;
- private:
- System::ComponentModel::Container ^components;
- #pragma region Windows Form Designer generated code
- void InitializeComponent(void)
- {
- this->comboBox1 = (gcnew System::Windows::Forms::ComboBox());
- this->label1 = (gcnew System::Windows::Forms::Label());
- this->textBox1 = (gcnew System::Windows::Forms::TextBox());
- this->label2 = (gcnew System::Windows::Forms::Label());
- this->checkBox1 = (gcnew System::Windows::Forms::CheckBox());
- this->checkBox2 = (gcnew System::Windows::Forms::CheckBox());
- this->checkBox3 = (gcnew System::Windows::Forms::CheckBox());
- this->label3 = (gcnew System::Windows::Forms::Label());
- this->label4 = (gcnew System::Windows::Forms::Label());
- this->SuspendLayout();
- //
- // comboBox1
- //
- this->comboBox1->FormattingEnabled = true;
- this->comboBox1->Items->AddRange(gcnew cli::array< System::Object^ >(3) { L"10", L"15", L"20" });
- this->comboBox1->Location = System::Drawing::Point(39, 89);
- this->comboBox1->Name = L"comboBox1";
- this->comboBox1->Size = System::Drawing::Size(162, 28);
- this->comboBox1->TabIndex = 0;
- this->comboBox1->Text = L"Ustaw procent";
- this->comboBox1->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::comboBox1_SelectedIndexChanged);
- //
- // label1
- //
- this->label1->AutoSize = true;
- this->label1->Location = System::Drawing::Point(35, 9);
- this->label1->Name = L"label1";
- this->label1->Size = System::Drawing::Size(80, 20);
- this->label1->TabIndex = 1;
- this->label1->Text = L"Zadanie 6";
- //
- // textBox1
- //
- this->textBox1->Location = System::Drawing::Point(39, 46);
- this->textBox1->MaxLength = 10;
- this->textBox1->Name = L"textBox1";
- this->textBox1->Size = System::Drawing::Size(100, 26);
- this->textBox1->TabIndex = 2;
- this->textBox1->TextChanged += gcnew System::EventHandler(this, &Form1::textBox1_TextChanged);
- //
- // label2
- //
- this->label2->AutoSize = true;
- this->label2->Location = System::Drawing::Point(473, 13);
- this->label2->Name = L"label2";
- this->label2->Size = System::Drawing::Size(80, 20);
- this->label2->TabIndex = 3;
- this->label2->Text = L"Zadanie 8";
- //
- // checkBox1
- //
- this->checkBox1->AutoSize = true;
- this->checkBox1->Location = System::Drawing::Point(477, 74);
- this->checkBox1->Name = L"checkBox1";
- this->checkBox1->Size = System::Drawing::Size(154, 24);
- this->checkBox1->TabIndex = 4;
- this->checkBox1->Text = L"felgi 17\" (2000zł)";
- this->checkBox1->UseVisualStyleBackColor = true;
- this->checkBox1->CheckedChanged += gcnew System::EventHandler(this, &Form1::checkBox1_CheckedChanged);
- //
- // checkBox2
- //
- this->checkBox2->AutoSize = true;
- this->checkBox2->Location = System::Drawing::Point(477, 114);
- this->checkBox2->Name = L"checkBox2";
- this->checkBox2->Size = System::Drawing::Size(231, 24);
- this->checkBox2->TabIndex = 5;
- this->checkBox2->Text = L"tapicerka skórzana (5000zł)";
- this->checkBox2->UseVisualStyleBackColor = true;
- this->checkBox2->CheckedChanged += gcnew System::EventHandler(this, &Form1::checkBox2_CheckedChanged);
- //
- // checkBox3
- //
- this->checkBox3->AutoSize = true;
- this->checkBox3->Location = System::Drawing::Point(477, 156);
- this->checkBox3->Name = L"checkBox3";
- this->checkBox3->Size = System::Drawing::Size(227, 24);
- this->checkBox3->TabIndex = 6;
- this->checkBox3->Text = L"reflektory LEDowe (2300zł)";
- this->checkBox3->UseVisualStyleBackColor = true;
- this->checkBox3->CheckedChanged += gcnew System::EventHandler(this, &Form1::checkBox3_CheckedChanged);
- //
- // label3
- //
- this->label3->AutoSize = true;
- this->label3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(238)));
- this->label3->Location = System::Drawing::Point(470, 207);
- this->label3->Name = L"label3";
- this->label3->Size = System::Drawing::Size(310, 32);
- this->label3->TabIndex = 7;
- this->label3->Text = L"Cena auta : 70000 PLN";
- //
- // label4
- //
- this->label4->AutoSize = true;
- this->label4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(238)));
- this->label4->Location = System::Drawing::Point(33, 135);
- this->label4->Name = L"label4";
- this->label4->Size = System::Drawing::Size(207, 32);
- this->label4->TabIndex = 8;
- this->label4->Text = L"Procent liczby :";
- //
- // Form1
- //
- this->AutoScaleDimensions = System::Drawing::SizeF(9, 20);
- this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
- this->ClientSize = System::Drawing::Size(892, 475);
- this->Controls->Add(this->label4);
- this->Controls->Add(this->label3);
- this->Controls->Add(this->checkBox3);
- this->Controls->Add(this->checkBox2);
- this->Controls->Add(this->checkBox1);
- this->Controls->Add(this->label2);
- this->Controls->Add(this->textBox1);
- this->Controls->Add(this->label1);
- this->Controls->Add(this->comboBox1);
- this->Name = L"Form1";
- this->Text = L"Made by Zuzanna Prościak, 10/05/2020";
- this->ResumeLayout(false);
- this->PerformLayout();
- }
- #pragma endregion
- private: System::Void checkBox1_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
- if (checkBox1->Checked) {
- price += 2000;
- label3->Text = "Cena auta : " + price + " PLN";
- }
- else {
- price -= 2000;
- label3->Text = "Cena auta : " + price + " PLN";
- }
- }
- private: System::Void checkBox2_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
- if (checkBox2->Checked) {
- price += 5000;
- label3->Text = "Cena auta : " + price + " PLN";
- }
- else {
- price -= 5000;
- label3->Text = "Cena auta : " + price + " PLN";
- }
- }
- private: System::Void checkBox3_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
- if (checkBox3->Checked) {
- price += 2300;
- label3->Text = "Cena auta : " + price + " PLN";
- }
- else {
- price -= 2300;
- label3->Text = "Cena auta : " + price +" PLN";
- }
- }
- private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
- if(textBox1->Text != ""){
- value = Convert::ToDouble(textBox1->Text);
- }
- else {
- label4->Text = comboBox1->Text + " procent liczby: 0 to 0";
- }
- }
- private: System::Void comboBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
- int index = comboBox1->SelectedIndex;
- double d = Convert::ToDouble(comboBox1->Items[index]);
- label4->Text = comboBox1->Text + " procent liczby: " + value + " to " + (d/100) * value;
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement