Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <string>
- #include "Form2.h"
- 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;
- using namespace std;
- int number = 1;
- int wynik = 0;
- public ref class Form1 : public System::Windows::Forms::Form
- {
- public:
- Form1(void)
- {
- InitializeComponent();
- }
- protected:
- ~Form1()
- {
- if (components)
- {
- delete components;
- }
- }
- private: System::Windows::Forms::Button^ button1;
- protected:
- private: System::Windows::Forms::Button^ button2;
- private: System::Windows::Forms::Label^ label1;
- private: System::Windows::Forms::Label^ label2;
- private: System::Windows::Forms::RadioButton^ radioButton1;
- private: System::Windows::Forms::RadioButton^ radioButton2;
- private: System::Windows::Forms::RadioButton^ radioButton3;
- private: System::Windows::Forms::Button^ button3;
- private: System::Windows::Forms::MenuStrip^ menuStrip1;
- private: System::Windows::Forms::ToolStripMenuItem^ nowyQuizToolStripMenuItem;
- private: System::Windows::Forms::ToolStripMenuItem^ oAutorzeToolStripMenuItem;
- private:
- System::ComponentModel::Container ^components;
- #pragma region Windows Form Designer generated code
- void InitializeComponent(void)
- {
- this->button1 = (gcnew System::Windows::Forms::Button());
- this->button2 = (gcnew System::Windows::Forms::Button());
- this->label1 = (gcnew System::Windows::Forms::Label());
- this->label2 = (gcnew System::Windows::Forms::Label());
- this->radioButton1 = (gcnew System::Windows::Forms::RadioButton());
- this->radioButton2 = (gcnew System::Windows::Forms::RadioButton());
- this->radioButton3 = (gcnew System::Windows::Forms::RadioButton());
- this->button3 = (gcnew System::Windows::Forms::Button());
- this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
- this->nowyQuizToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->oAutorzeToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->menuStrip1->SuspendLayout();
- this->SuspendLayout();
- //
- // button1
- //
- this->button1->Location = System::Drawing::Point(34, 55);
- this->button1->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
- this->button1->Name = L"button1";
- this->button1->Size = System::Drawing::Size(112, 35);
- this->button1->TabIndex = 0;
- this->button1->Text = L"Poprzednie";
- this->button1->UseVisualStyleBackColor = true;
- this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
- //
- // button2
- //
- this->button2->Location = System::Drawing::Point(154, 55);
- this->button2->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
- this->button2->Name = L"button2";
- this->button2->Size = System::Drawing::Size(112, 35);
- this->button2->TabIndex = 1;
- this->button2->Text = L"Następne";
- this->button2->UseVisualStyleBackColor = true;
- this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
- //
- // label1
- //
- this->label1->AutoSize = true;
- this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(238)));
- this->label1->Location = System::Drawing::Point(295, 57);
- this->label1->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
- this->label1->Name = L"label1";
- this->label1->Size = System::Drawing::Size(136, 33);
- this->label1->TabIndex = 2;
- this->label1->Text = L"Pytanie 1";
- //
- // label2
- //
- this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(238)));
- this->label2->Location = System::Drawing::Point(36, 117);
- this->label2->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
- this->label2->Name = L"label2";
- this->label2->Size = System::Drawing::Size(719, 65);
- this->label2->TabIndex = 3;
- this->label2->Text = L"Kliknij aby poznać pytanie";
- this->label2->Click += gcnew System::EventHandler(this, &Form1::label2_Click);
- //
- // radioButton1
- //
- this->radioButton1->AutoSize = true;
- this->radioButton1->Location = System::Drawing::Point(42, 187);
- this->radioButton1->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
- this->radioButton1->Name = L"radioButton1";
- this->radioButton1->Size = System::Drawing::Size(125, 24);
- this->radioButton1->TabIndex = 4;
- this->radioButton1->TabStop = true;
- this->radioButton1->Text = L"odpowiedź A";
- this->radioButton1->UseVisualStyleBackColor = true;
- this->radioButton1->CheckedChanged += gcnew System::EventHandler(this, &Form1::radioButton1_CheckedChanged);
- //
- // radioButton2
- //
- this->radioButton2->AutoSize = true;
- this->radioButton2->Location = System::Drawing::Point(42, 221);
- this->radioButton2->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
- this->radioButton2->Name = L"radioButton2";
- this->radioButton2->Size = System::Drawing::Size(125, 24);
- this->radioButton2->TabIndex = 5;
- this->radioButton2->TabStop = true;
- this->radioButton2->Text = L"odpowiedź B";
- this->radioButton2->UseVisualStyleBackColor = true;
- //
- // radioButton3
- //
- this->radioButton3->AutoSize = true;
- this->radioButton3->Location = System::Drawing::Point(43, 255);
- this->radioButton3->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
- this->radioButton3->Name = L"radioButton3";
- this->radioButton3->Size = System::Drawing::Size(125, 24);
- this->radioButton3->TabIndex = 6;
- this->radioButton3->TabStop = true;
- this->radioButton3->Text = L"odpowiedź C";
- this->radioButton3->UseVisualStyleBackColor = true;
- //
- // button3
- //
- this->button3->Location = System::Drawing::Point(40, 289);
- this->button3->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
- this->button3->Name = L"button3";
- this->button3->Size = System::Drawing::Size(112, 35);
- this->button3->TabIndex = 8;
- this->button3->Text = L"OK";
- this->button3->UseVisualStyleBackColor = true;
- this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
- //
- // menuStrip1
- //
- this->menuStrip1->GripMargin = System::Windows::Forms::Padding(2, 2, 0, 2);
- this->menuStrip1->ImageScalingSize = System::Drawing::Size(24, 24);
- this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {
- this->nowyQuizToolStripMenuItem,
- this->oAutorzeToolStripMenuItem
- });
- this->menuStrip1->Location = System::Drawing::Point(0, 0);
- this->menuStrip1->Name = L"menuStrip1";
- this->menuStrip1->Size = System::Drawing::Size(892, 33);
- this->menuStrip1->TabIndex = 9;
- this->menuStrip1->Text = L"menuStrip1";
- //
- // nowyQuizToolStripMenuItem
- //
- this->nowyQuizToolStripMenuItem->Name = L"nowyQuizToolStripMenuItem";
- this->nowyQuizToolStripMenuItem->Size = System::Drawing::Size(112, 29);
- this->nowyQuizToolStripMenuItem->Text = L"Nowy quiz";
- this->nowyQuizToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::nowyQuizToolStripMenuItem_Click);
- //
- // oAutorzeToolStripMenuItem
- //
- this->oAutorzeToolStripMenuItem->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
- this->oAutorzeToolStripMenuItem->Name = L"oAutorzeToolStripMenuItem";
- this->oAutorzeToolStripMenuItem->Size = System::Drawing::Size(106, 29);
- this->oAutorzeToolStripMenuItem->Text = L"O autorze";
- this->oAutorzeToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::oAutorzeToolStripMenuItem_Click);
- //
- // Form1
- //
- this->AutoScaleDimensions = System::Drawing::SizeF(9, 20);
- this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
- this->ClientSize = System::Drawing::Size(892, 352);
- this->Controls->Add(this->button3);
- this->Controls->Add(this->radioButton3);
- this->Controls->Add(this->radioButton2);
- this->Controls->Add(this->radioButton1);
- this->Controls->Add(this->label2);
- this->Controls->Add(this->label1);
- this->Controls->Add(this->button2);
- this->Controls->Add(this->button1);
- this->Controls->Add(this->menuStrip1);
- this->MainMenuStrip = this->menuStrip1;
- this->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
- this->Name = L"Form1";
- this->Text = L"Quiz o psach - Krzysztof Witosiński";
- this->menuStrip1->ResumeLayout(false);
- this->menuStrip1->PerformLayout();
- this->ResumeLayout(false);
- this->PerformLayout();
- }
- #pragma endregion
- private: System::Void label2_Click(System::Object^ sender, System::EventArgs^ e) {
- if (number == 1) {
- label2->Text = " Rasa wyhodowana we Francji na przełomie XIX i XX w. Psy osiągają masę 8-14 kg, mają duże, stojące uszy";
- radioButton1->Text = "pekińczyk";
- radioButton2->Text = "mops";
- radioButton3->Text = "buldog francuski"; //poprawna odp
- }
- if (number == 2) {
- label2->Text = "Rasa zaliczana do grupy molosów w typie mastifa, pochodząca z Półwyspu Apenińskiego. Pies stróżujący, obronny, tropiący i policyjny";
- radioButton1->Text = "cane corso";//poprawna odp
- radioButton2->Text = "rottweiler";
- radioButton3->Text = "bokser";
- }
- if (number == 3) {
- label2->Text = "Rasa z grupy terierów, wyhodowana w Anglii w połowie XIX w. w wyniku krzyżowania dawnych ras terierów z buldogiem angielskim i dalmatyńczykiem";
- radioButton1->Text = "bulterier";//poprawna odp
- radioButton2->Text = "terier tybetański";
- radioButton3->Text = "foksterier krótkowłosy";
- }
- if (number == 4) {
- label2->Text = "Rasa wyhodowana w Niemczech, znana od XVIII w., początkowo używana do polowań na dziki i niedźwiedzie, a nawet do walk z bykami";
- radioButton1->Text = "bulldog angielski";
- radioButton2->Text = "bokser";//poprawna odp
- radioButton3->Text = "mastif neapolitański";
- }
- if (number == 5) {
- label2->Text = "Rasa zaliczana do psów gończych, wyhodowana w Wielkiej Brytanii przypuszczalnie pod koniec XV wieku";
- radioButton1->Text = "basset";
- radioButton2->Text = "posokowiec bawarski";
- radioButton3->Text = "beagle";//poprawna odp
- }
- if (number == 6) {
- label2->Text = "Niewielki pies pokojowy pochodzenia azjatyckiego";
- radioButton1->Text = "mops";
- radioButton2->Text = "boston terrier";//poprawna odp
- radioButton3->Text = "papillon";
- }
- if (number == 7) {
- label2->Text = "Rasa psów myśliwskich zaliczana do psów gończych, cechująca się znaczną wytrzymałością i wytrwałością w pogoni za zwierzyną";
- radioButton1->Text = "szpic fiński";
- radioButton2->Text = "niemiecki terrier myśliwski";
- radioButton3->Text = "jamnik";//poprawna odp
- }
- if (number == 8) {
- label2->Text = "Rasa zaliczana do grupy molosów, wyhodowana jako pies bojowy i do polowania na duże ssaki";
- radioButton1->Text = "dog argentyński";
- radioButton2->Text = "dog niemiecki";//poprawna odp
- radioButton3->Text = "dog de bordeaux";
- }
- if (number == 9) {
- label2->Text = "Rasa o krępej budowie ciała, krótkich mocnych łapach i żuchwie wysuniętej do przodu pyska";
- radioButton1->Text = "nowofundland";
- radioButton2->Text = "buldog amerykański";
- radioButton3->Text = "buldog angielski";//poprawna odp
- }
- if (number == 10) {
- label2->Text = "Rasa niegdyś używana w trakcie polowań do aportowania ptactwa wodnego, obecnie głównie jako psy ozdobne";
- radioButton1->Text = "pudel";//poprawna odp
- radioButton2->Text = "samojed";
- radioButton3->Text = "chow chow";
- }
- if (number == 11) {
- label2->Text = "Rasa psa myśliwskiego, wykorzystywanego głównie do wystawiania, wypłaszania i aportowania ptactwa";
- radioButton1->Text = "seter angielski";
- radioButton2->Text = "wyżeł niemiecki";//poprawna odp
- radioButton3->Text = "golden retriever";
- }
- if (number == 12) {
- label2->Text = "JRasa wyhodowana w średniowieczu w Meksyku. Wywodzi się od świętego psa Azteków - teechichi";
- radioButton1->Text = "yorkshire terrier";
- radioButton2->Text = "chihuahua";//poprawna odp
- radioButton3->Text = "maltańczyk";
- }
- }
- private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
- if (number == 1) {
- if (radioButton1->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- if (radioButton2->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- if (radioButton3->Checked) {
- MessageBox::Show("Odpowiedź poprawna + 1 pkt");
- wynik += 1;
- }
- }
- if (number == 2) {
- if (radioButton1->Checked) {
- MessageBox::Show("Odpowiedź poprawna + 1 pkt");
- wynik += 1;
- }
- if (radioButton2->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- if (radioButton3->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- }
- if (number == 3) {
- if (radioButton1->Checked) {
- MessageBox::Show("Odpowiedź poprawna + 1 pkt");
- wynik += 1;
- }
- if (radioButton2->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- if (radioButton3->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- }
- if (number == 4) {
- if (radioButton1->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- if (radioButton2->Checked) {
- MessageBox::Show("Odpowiedź poprawna + 1 pkt");
- wynik += 1;
- }
- if (radioButton3->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- }
- if (number == 5) {
- if (radioButton1->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- if (radioButton2->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- if (radioButton3->Checked) {
- MessageBox::Show("Odpowiedź poprawna + 1 pkt");
- wynik += 1;
- }
- }
- if (number == 6) {
- if (radioButton1->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- if (radioButton2->Checked) {
- MessageBox::Show("Odpowiedź poprawna + 1 pkt");
- wynik += 1;
- }
- if (radioButton3->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- }
- if (number == 7) {
- if (radioButton1->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- if (radioButton2->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- if (radioButton3->Checked) {
- MessageBox::Show("Odpowiedź poprawna + 1 pkt");
- wynik += 1;
- }
- }
- if (number == 8) {
- if (radioButton1->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- if (radioButton2->Checked) {
- MessageBox::Show("Odpowiedź poprawna + 1 pkt");
- wynik += 1;
- }
- if (radioButton3->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- }
- if (number == 9) {
- if (radioButton1->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- if (radioButton2->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- if (radioButton3->Checked) {
- MessageBox::Show("Odpowiedź poprawna + 1 pkt");
- wynik += 1;
- }
- }
- if (number == 10) {
- if (radioButton1->Checked) {
- MessageBox::Show("Odpowiedź poprawna + 1 pkt");
- wynik += 1;
- }
- if (radioButton2->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- if (radioButton3->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- }
- if (number == 11) {
- if (radioButton1->Checked) {
- MessageBox::Show("Odpowiedź poprawna + 1 pkt");
- wynik += 1;
- }
- if (radioButton2->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- if (radioButton3->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- }
- if (number == 12) {
- if (radioButton1->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- if (radioButton2->Checked) {
- MessageBox::Show("Odpowiedź poprawna + 1 pkt");
- wynik += 1;
- }
- if (radioButton3->Checked) {
- MessageBox::Show("Odpowiedź niepoprawna");
- }
- MessageBox::Show("Twój wynik quizu: " + wynik + " na 12 możliwych", "Wynik");
- }
- }
- private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
- number++;
- label1->Text = "Pytanie " + number;
- label2->Text = "Kliknij aby poznać pytanie";
- radioButton1->Text = "odpowiedź A";
- radioButton2->Text = "odpowiedź B";
- radioButton3->Text = "odpowiedź C";
- radioButton1->Checked = false;
- radioButton2->Checked = false;
- radioButton3->Checked = false;
- if (number >= 12) {
- MessageBox::Show("Dwunaste pytanie jest ostatnie!");
- number = 12;
- label1->Text = "Pytanie " + number;
- }
- }
- private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
- number--;
- label1->Text = "Pytanie " + number;
- label2->Text = "Kliknij aby poznać pytanie";
- radioButton1->Text = "odpowiedź A";
- radioButton2->Text = "odpowiedź B";
- radioButton3->Text = "odpowiedź C";
- radioButton1->Checked = false;
- radioButton2->Checked = false;
- radioButton3->Checked = false;
- if (number <= 1) {
- MessageBox::Show("Cofnięto do pierwsze pytanie!");
- number = 1;
- label1->Text = "Pytanie " + number;
- }
- }
- private: System::Void radioButton1_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void oAutorzeToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
- Form2^ form2 = gcnew Form2;
- form2->Show();
- }
- private: System::Void nowyQuizToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
- number = 1;
- label1->Text = "Pytanie " + number;
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement