Visual studio 2015 状态\u堆栈\u缓冲区\u遇到溢出VS 2015

Visual studio 2015 状态\u堆栈\u缓冲区\u遇到溢出VS 2015,visual-studio-2015,c++-cli,visual-studio-2005,Visual Studio 2015,C++ Cli,Visual Studio 2005,将代码(Windows窗体应用程序)从VS 2005重写到VS 2015后,出现“状态\堆栈\缓冲区\溢出”错误。在VS2005中,程序运行良好。我真的不知道怎么了。代码是用XP操作系统编写的。现在我尝试在win7 64位VS2015上启动它。这个程序是我编程课上的一个例子。需要将其重新用于其他目的 #pragma once namespace Fal_end { #include <math.h> using namespace System; using

将代码(Windows窗体应用程序)从VS 2005重写到VS 2015后,出现“状态\堆栈\缓冲区\溢出”错误。在VS2005中,程序运行良好。我真的不知道怎么了。代码是用XP操作系统编写的。现在我尝试在win7 64位VS2015上启动它。这个程序是我编程课上的一个例子。需要将其重新用于其他目的

#pragma once



namespace Fal_end {
#include <math.h>

    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 Form1
    ///
    /// WARNING: If you change the name of this class, you will need to change the
    ///          'Resource File Name' property for the managed resource compiler tool
    ///          associated with all .resx files this class depends on.  Otherwise,
    ///          the designers will not be able to interact properly with localized
    ///          resources associated with this form.
    /// </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::Label^  label13;
    protected:
    private: System::Windows::Forms::Label^  label12;
    private: System::Windows::Forms::Button^  button1;
    private: System::Windows::Forms::Label^  label11;
    private: System::Windows::Forms::Label^  label10;
    private: System::Windows::Forms::Label^  label9;
    private: System::Windows::Forms::TextBox^  pred_zadana;
    private: System::Windows::Forms::Label^  label8;
    private: System::Windows::Forms::Label^  label7;
    private: System::Windows::Forms::TextBox^  bieguny;
    private: System::Windows::Forms::Label^  label6;
    private: System::Windows::Forms::TextBox^  czestotliwosc;
    private: System::Windows::Forms::Label^  label5;
    private: System::Windows::Forms::TextBox^  predkosc;
    private: System::Windows::Forms::Label^  label4;
    private: System::Windows::Forms::TextBox^  napiecie;
    private: System::Windows::Forms::Label^  label3;
    private: System::Windows::Forms::TextBox^  textBox1;
    private: System::Windows::Forms::Label^  label2;
    private: System::Windows::Forms::Label^  label1;




    private: System::Windows::Forms::Label^  label17;
    private: System::Windows::Forms::Label^  label18;
    private: System::Windows::Forms::TextBox^  okres_amp;

    private: System::Windows::Forms::Label^  label15;
    private: System::Windows::Forms::Label^  label16;
    private: System::Windows::Forms::Label^  label14;


    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->label13 = (gcnew System::Windows::Forms::Label());
            this->label12 = (gcnew System::Windows::Forms::Label());
            this->button1 = (gcnew System::Windows::Forms::Button());
            this->label11 = (gcnew System::Windows::Forms::Label());
            this->label10 = (gcnew System::Windows::Forms::Label());
            this->label9 = (gcnew System::Windows::Forms::Label());
            this->pred_zadana = (gcnew System::Windows::Forms::TextBox());
            this->label8 = (gcnew System::Windows::Forms::Label());
            this->label7 = (gcnew System::Windows::Forms::Label());
            this->bieguny = (gcnew System::Windows::Forms::TextBox());
            this->label6 = (gcnew System::Windows::Forms::Label());
            this->czestotliwosc = (gcnew System::Windows::Forms::TextBox());
            this->label5 = (gcnew System::Windows::Forms::Label());
            this->predkosc = (gcnew System::Windows::Forms::TextBox());
            this->label4 = (gcnew System::Windows::Forms::Label());
            this->napiecie = (gcnew System::Windows::Forms::TextBox());
            this->label3 = (gcnew System::Windows::Forms::Label());
            this->textBox1 = (gcnew System::Windows::Forms::TextBox());
            this->label2 = (gcnew System::Windows::Forms::Label());
            this->label1 = (gcnew System::Windows::Forms::Label());
            this->label17 = (gcnew System::Windows::Forms::Label());
            this->label18 = (gcnew System::Windows::Forms::Label());
            this->okres_amp = (gcnew System::Windows::Forms::TextBox());
            this->label15 = (gcnew System::Windows::Forms::Label());
            this->label16 = (gcnew System::Windows::Forms::Label());
            this->label14 = (gcnew System::Windows::Forms::Label());
            this->SuspendLayout();
            // 
            // label13
            // 
            this->label13->AutoSize = true;
            this->label13->Location = System::Drawing::Point(430, 223);
            this->label13->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
            this->label13->Name = L"label13";
            this->label13->Size = System::Drawing::Size(49, 20);
            this->label13->TabIndex = 42;
            this->label13->Text = L"..........";
            // 
            // label12
            // 
            this->label12->AutoSize = true;
            this->label12->Location = System::Drawing::Point(430, 185);
            this->label12->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
            this->label12->Name = L"label12";
            this->label12->Size = System::Drawing::Size(49, 20);
            this->label12->TabIndex = 41;
            this->label12->Text = L"..........";
            // 
            // button1
            // 
            this->button1->Location = System::Drawing::Point(468, 397);
            this->button1->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
            this->button1->Name = L"button1";
            this->button1->Size = System::Drawing::Size(128, 62);
            this->button1->TabIndex = 40;
            this->button1->Text = L"SYMULACJA";
            this->button1->UseVisualStyleBackColor = true;
            this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
            // 
            // label11
            // 
            this->label11->AutoSize = true;
            this->label11->Location = System::Drawing::Point(268, 223);
            this->label11->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
            this->label11->Name = L"label11";
            this->label11->Size = System::Drawing::Size(142, 20);
            this->label11->TabIndex = 39;
            this->label11->Text = L"Czestotliwość [Hz]:";
            // 
            // label10
            // 
            this->label10->AutoSize = true;
            this->label10->Location = System::Drawing::Point(268, 186);
            this->label10->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
            this->label10->Name = L"label10";
            this->label10->Size = System::Drawing::Size(97, 20);
            this->label10->TabIndex = 38;
            this->label10->Text = L"Napięcie [V]:";
            // 
            // label9
            // 
            this->label9->AutoSize = true;
            this->label9->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(238)));
            this->label9->Location = System::Drawing::Point(267, 142);
            this->label9->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
            this->label9->Name = L"label9";
            this->label9->Size = System::Drawing::Size(138, 29);
            this->label9->TabIndex = 37;
            this->label9->Text = L"Parametry:";
            this->label9->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
            // 
            // pred_zadana
            // 
            this->pred_zadana->Location = System::Drawing::Point(273, 91);
            this->pred_zadana->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
            this->pred_zadana->Name = L"pred_zadana";
            this->pred_zadana->Size = System::Drawing::Size(148, 26);
            this->pred_zadana->TabIndex = 36;
            this->pred_zadana->Text = L"1000";
            // 
            // label8
            // 
            this->label8->AutoSize = true;
            this->label8->Location = System::Drawing::Point(268, 65);
            this->label8->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
            this->label8->Name = L"label8";
            this->label8->Size = System::Drawing::Size(138, 20);
            this->label8->TabIndex = 35;
            this->label8->Text = L"predkość [obr/min]";
            // 
            // label7
            // 
            this->label7->AutoSize = true;
            this->label7->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(238)));
            this->label7->Location = System::Drawing::Point(267, 15);
            this->label7->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
            this->label7->Name = L"label7";
            this->label7->Size = System::Drawing::Size(119, 29);
            this->label7->TabIndex = 34;
            this->label7->Text = L"Zadajnik:";
            this->label7->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
            // 
            // bieguny
            // 
            this->bieguny->Location = System::Drawing::Point(21, 378);
            this->bieguny->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
            this->bieguny->Name = L"bieguny";
            this->bieguny->Size = System::Drawing::Size(148, 26);
            this->bieguny->TabIndex = 33;
            this->bieguny->Text = L"2";
            // 
            // label6
            // 
            this->label6->AutoSize = true;
            this->label6->Location = System::Drawing::Point(16, 352);
            this->label6->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
            this->label6->Name = L"label6";
            this->label6->Size = System::Drawing::Size(27, 20);
            this->label6->TabIndex = 32;
            this->label6->Text = L"pb";
            // 
            // czestotliwosc
            // 
            this->czestotliwosc->Location = System::Drawing::Point(21, 306);
            this->czestotliwosc->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
            this->czestotliwosc->Name = L"czestotliwosc";
            this->czestotliwosc->Size = System::Drawing::Size(148, 26);
            this->czestotliwosc->TabIndex = 31;
            this->czestotliwosc->Text = L"50";
            // 
            // label5
            // 
            this->label5->AutoSize = true;
            this->label5->Location = System::Drawing::Point(16, 280);
            this->label5->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
            this->label5->Name = L"label5";
            this->label5->Size = System::Drawing::Size(54, 20);
            this->label5->TabIndex = 30;
            this->label5->Text = L"fs [Hz]";
            // 
            // predkosc
            // 
            this->predkosc->Location = System::Drawing::Point(21, 232);
            this->predkosc->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
            this->predkosc->Name = L"predkosc";
            this->predkosc->Size = System::Drawing::Size(148, 26);
            this->predkosc->TabIndex = 29;
            this->predkosc->Text = L"1475";
            this->predkosc->TextChanged += gcnew System::EventHandler(this, &Form1::textBox1_TextChanged);
            // 
            // label4
            // 
            this->label4->AutoSize = true;
            this->label4->Location = System::Drawing::Point(16, 206);
            this->label4->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
            this->label4->Name = L"label4";
            this->label4->Size = System::Drawing::Size(82, 20);
            this->label4->TabIndex = 28;
            this->label4->Text = L"n [obr/min]";
            // 
            // napiecie
            // 
            this->napiecie->Location = System::Drawing::Point(21, 162);
            this->napiecie->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
            this->napiecie->Name = L"napiecie";
            this->napiecie->Size = System::Drawing::Size(148, 26);
            this->napiecie->TabIndex = 27;
            this->napiecie->Text = L"380";
            // 
            // label3
            // 
            this->label3->AutoSize = true;
            this->label3->Location = System::Drawing::Point(16, 135);
            this->label3->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
            this->label3->Name = L"label3";
            this->label3->Size = System::Drawing::Size(53, 20);
            this->label3->TabIndex = 26;
            this->label3->Text = L"Un [V]";
            // 
            // textBox1
            // 
            this->textBox1->Location = System::Drawing::Point(21, 91);
            this->textBox1->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
            this->textBox1->Name = L"textBox1";
            this->textBox1->Size = System::Drawing::Size(148, 26);
            this->textBox1->TabIndex = 25;
            this->textBox1->Text = L"15000";
            this->textBox1->TextChanged += gcnew System::EventHandler(this, &Form1::textBox1_TextChanged);
            // 
            // label2
            // 
            this->label2->AutoSize = true;
            this->label2->Location = System::Drawing::Point(16, 65);
            this->label2->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
            this->label2->Name = L"label2";
            this->label2->Size = System::Drawing::Size(55, 20);
            this->label2->TabIndex = 24;
            this->label2->Text = L"Pn [W]";
            // 
            // label1
            // 
            this->label1->AutoSize = true;
            this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(238)));
            this->label1->Location = System::Drawing::Point(15, 15);
            this->label1->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
            this->label1->Name = L"label1";
            this->label1->Size = System::Drawing::Size(223, 29);
            this->label1->TabIndex = 23;
            this->label1->Text = L"Par. Znamionowe:";
            this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
            // 
            // label17
            // 
            this->label17->AutoSize = true;
            this->label17->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(238)));
            this->label17->Location = System::Drawing::Point(267, 303);
            this->label17->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
            this->label17->Name = L"label17";
            this->label17->Size = System::Drawing::Size(139, 29);
            this->label17->TabIndex = 47;
            this->label17->Text = L"Symulacja:";
            this->label17->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
            // 
            // label18
            // 
            this->label18->AutoSize = true;
            this->label18->Location = System::Drawing::Point(268, 340);
            this->label18->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
            this->label18->Name = L"label18";
            this->label18->Size = System::Drawing::Size(174, 20);
            this->label18->TabIndex = 48;
            this->label18->Text = L"ilość okresów amplitudy";
            // 
            // okres_amp
            // 
            this->okres_amp->Location = System::Drawing::Point(273, 378);
            this->okres_amp->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
            this->okres_amp->Name = L"okres_amp";
            this->okres_amp->Size = System::Drawing::Size(148, 26);
            this->okres_amp->TabIndex = 49;
            this->okres_amp->Text = L"2";
            // 
            // label15
            // 
            this->label15->AutoSize = true;
            this->label15->Location = System::Drawing::Point(852, 135);
            this->label15->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
            this->label15->Name = L"label15";
            this->label15->Size = System::Drawing::Size(0, 20);
            this->label15->TabIndex = 51;
            // 
            // label16
            // 
            this->label16->AutoSize = true;
            this->label16->Location = System::Drawing::Point(828, 135);
            this->label16->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
            this->label16->Name = L"label16";
            this->label16->Size = System::Drawing::Size(0, 20);
            this->label16->TabIndex = 52;
            // 
            // label14
            // 
            this->label14->AutoSize = true;
            this->label14->Location = System::Drawing::Point(888, 135);
            this->label14->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
            this->label14->Name = L"label14";
            this->label14->Size = System::Drawing::Size(0, 20);
            this->label14->TabIndex = 53;
            // 
            // Form1
            // 
            this->AutoScaleDimensions = System::Drawing::SizeF(9, 20);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this->ClientSize = System::Drawing::Size(1132, 463);
            this->Controls->Add(this->label14);
            this->Controls->Add(this->label16);
            this->Controls->Add(this->label15);
            this->Controls->Add(this->okres_amp);
            this->Controls->Add(this->label18);
            this->Controls->Add(this->label17);
            this->Controls->Add(this->label13);
            this->Controls->Add(this->label12);
            this->Controls->Add(this->button1);
            this->Controls->Add(this->label11);
            this->Controls->Add(this->label10);
            this->Controls->Add(this->label9);
            this->Controls->Add(this->pred_zadana);
            this->Controls->Add(this->label8);
            this->Controls->Add(this->label7);
            this->Controls->Add(this->bieguny);
            this->Controls->Add(this->label6);
            this->Controls->Add(this->czestotliwosc);
            this->Controls->Add(this->label5);
            this->Controls->Add(this->predkosc);
            this->Controls->Add(this->label4);
            this->Controls->Add(this->napiecie);
            this->Controls->Add(this->label3);
            this->Controls->Add(this->textBox1);
            this->Controls->Add(this->label2);
            this->Controls->Add(this->label1);
            this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::Fixed3D;
            this->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
            this->Name = L"Form1";
            this->Text = L"Falownik Napięcia z modulacją szerokości impulsów MSI";
            this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
            this->ResumeLayout(false);
            this->PerformLayout();

        }
#pragma endregion
    private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
        // deklaracja zmiennych         
        double n1, ns, fs, sn, f, pred_z, nap_U, x, U;
        double  t, tt = 0, y_sin, roz_t;
        double pi = 3.14159265359;
        int i = 0, x0;
        double y0;
        double T = 0;   // okres przebiegu
        int pb;   // liczba par biegunów


                  //label14->Text = ("|");

        fs = Convert::ToDouble(czestotliwosc->Text);
        pb = Convert::ToInt16(bieguny->Text);
        n1 = (60 * fs) / pb;
        ns = Convert::ToDouble(predkosc->Text);
        sn = (n1 - ns) / n1;
        sn = (int)(sn * 1000) / 1000.0;    // Odcinanie cyfr po przecinku

        pred_z = Convert::ToDouble(pred_zadana->Text);
        f = (pred_z*pb) / (60 * (1 - sn));
        T = (1 / f) * 1000;
        f = (int)(f * 10) / 10.0; // Odcinanie cyfr po przecinku

        T = (int)(T * 10) / 10.0; // Odcinanie cyfr po przecinku

        label16->Text = ("T=");
        label14->Text = ("ms");
        label15->Text = Convert::ToString(T);

        nap_U = Convert::ToDouble(napiecie->Text);
        x = nap_U / fs;
        U = x*f;
        U = (int)(U * 10) / 10.0; // Odcinanie cyfr po przecinku

        double wsp_nap;
        wsp_nap = U / nap_U; // amplituda sinusoidy 

        label12->Text = Convert::ToString(U);
        label13->Text = Convert::ToString(f);
        //label16->Text = Convert::ToString(wsp_nap);

        Graphics^ g1 = this->CreateGraphics();
        g1->Clear(Color::White);                 // Czyszczenie obrazu
        Pen^ pioro1 = gcnew Pen(System::Drawing::Color::Black);
        Pen^ pioro2 = gcnew Pen(System::Drawing::Color::Black);
        Pen^ pioro3 = gcnew Pen(System::Drawing::Color::Red);
        pioro1->Width = 2;
        pioro2->Width = 1;
        pioro3->Width = 2;

        g1->DrawLine(pioro1, 405, 0, 750, 0);   // ramka górna
        g1->DrawLine(pioro1, 750, 0, 750, 160);
        g1->DrawLine(pioro1, 750, 160, 405, 160);
        g1->DrawLine(pioro1, 405, 160, 405, 0);

        g1->DrawLine(pioro2, 405, 80, 750, 80);  //oś górna x
        g1->DrawLine(pioro2, 405, 235, 750, 235);   //oś górna x

        g1->DrawLine(pioro1, 405, 165, 750, 165);   // ramka dolna
        g1->DrawLine(pioro1, 750, 165, 750, 305);
        g1->DrawLine(pioro1, 750, 305, 405, 305);
        g1->DrawLine(pioro1, 405, 305, 405, 165);

        int okres;
        int sinus_tab[345];


        okres = Convert::ToInt32(okres_amp->Text);

        t = okres / f;          // czas 2 okresów sinusoidy o czestotliwosci f

        roz_t = t / 345;     //Rozdzielczość czasu na osi x, 345 piksele



        while (tt <= t)         // pętla rysująca sinusoidę
        {

            if (tt == 0)                // pierwszy punkt
            {
                y_sin = wsp_nap * sin(2 * pi*f*tt) * 70;
            }
            else
            {
                y_sin = wsp_nap * sin(2 * pi*f*tt) * 70;

                g1->DrawLine(pioro3, x0 + 405, 80 - Convert::ToInt32(y0), i + 405, 80 - Convert::ToInt32(y_sin));

            }
            y0 = y_sin;
            x0 = i;

            sinus_tab[i] = 80 - Convert::ToInt32(y0); // tablica elementów sinusa

            tt = tt + roz_t;
            i = i + 1;

        }

        //Rysowanie trójkąta
        i = 0;
        int tr = 0, tr0 = 0;
        int troj_tab[345];

        while (i <= 345)
        {
            if (i == 0)
            {
                tr0 = 80;
                troj_tab[i] = tr0;
            }

            if (i <= 10 && i > 0)
            {
                tr = 80 - 8 * i;
                g1->DrawLine(pioro2, 405 + i, tr0, 405 + i + 1, tr);
                tr0 = tr;
                troj_tab[i] = tr0;
            }

            if (i > 10 && i <= 30)
            {
                tr = 0 + 8 * (i - 10);
                g1->DrawLine(pioro2, 405 + i, tr0, 405 + i + 1, tr);
                tr0 = tr;
                troj_tab[i] = tr0;
            }
            if (i > 30 && i <= 50)
            {
                tr = 160 - 8 * (i - 30);
                g1->DrawLine(pioro2, 405 + i, tr0, 405 + i + 1, tr);
                tr0 = tr;
                troj_tab[i] = tr0;
            }
            if (i > 50 && i <= 70)
            {
                tr = 0 + 8 * (i - 50);
                g1->DrawLine(pioro2, 405 + i, tr0, 405 + i + 1, tr);
                tr0 = tr;
                troj_tab[i] = tr0;
            }

            if (i > 70 && i <= 90)
            {
                tr = 160 - 8 * (i - 70);
                g1->DrawLine(pioro2, 405 + i, tr0, 405 + i + 1, tr);
                tr0 = tr;
                troj_tab[i] = tr0;
            }
            if (i > 90 && i <= 110)
            {
                tr = 0 + 8 * (i - 90);
                g1->DrawLine(pioro2, 405 + i, tr0, 405 + i + 1, tr);
                tr0 = tr;
                troj_tab[i] = tr0;
            }

            if (i > 110 && i <= 130)
            {
                tr = 160 - 8 * (i - 110);
                g1->DrawLine(pioro2, 405 + i, tr0, 405 + i + 1, tr);
                tr0 = tr;
                troj_tab[i] = tr0;
            }
            if (i > 130 && i <= 150)
            {
                tr = 0 + 8 * (i - 130);
                g1->DrawLine(pioro2, 405 + i, tr0, 405 + i + 1, tr);
                tr0 = tr;
                troj_tab[i] = tr0;
            }

            if (i > 150 && i <= 170)
            {
                tr = 160 - 8 * (i - 150);
                g1->DrawLine(pioro2, 405 + i, tr0, 405 + i + 1, tr);
                tr0 = tr;
                troj_tab[i] = tr0;
            }
            if (i > 170 && i <= 190)
            {
                tr = 0 + 8 * (i - 170);
                g1->DrawLine(pioro2, 405 + i, tr0, 405 + i + 1, tr);
                tr0 = tr;
                troj_tab[i] = tr0;
            }

            if (i > 190 && i <= 210)
            {
                tr = 160 - 8 * (i - 190);
                g1->DrawLine(pioro2, 405 + i, tr0, 405 + i + 1, tr);
                tr0 = tr;
                troj_tab[i] = tr0;
            }
            if (i > 210 && i <= 230)
            {
                tr = 0 + 8 * (i - 210);
                g1->DrawLine(pioro2, 405 + i, tr0, 405 + i + 1, tr);
                tr0 = tr;
                troj_tab[i] = tr0;
            }

            if (i > 230 && i <= 250)
            {
                tr = 160 - 8 * (i - 230);
                g1->DrawLine(pioro2, 405 + i, tr0, 405 + i + 1, tr);
                tr0 = tr;
                troj_tab[i] = tr0;
            }
            if (i > 250 && i <= 270)
            {
                tr = 0 + 8 * (i - 250);
                g1->DrawLine(pioro2, 405 + i, tr0, 405 + i + 1, tr);
                tr0 = tr;
                troj_tab[i] = tr0;
            }

            if (i > 270 && i <= 290)
            {
                tr = 160 - 8 * (i - 270);
                g1->DrawLine(pioro2, 405 + i, tr0, 405 + i + 1, tr);
                tr0 = tr;
                troj_tab[i] = tr0;
            }
            if (i > 290 && i <= 310)
            {
                tr = 0 + 8 * (i - 290);
                g1->DrawLine(pioro2, 405 + i, tr0, 405 + i + 1, tr);
                tr0 = tr;
                troj_tab[i] = tr0;
            }
            if (i > 310 && i <= 330)
            {
                tr = 160 - 8 * (i - 310);
                g1->DrawLine(pioro2, 405 + i, tr0, 405 + i + 1, tr);
                tr0 = tr;
                troj_tab[i] = tr0;
            }
            if (i > 330 && i <= 345)
            {
                tr = 0 + 8 * (i - 330);
                g1->DrawLine(pioro2, 405 + i, tr0, 405 + i + 1, tr);
                tr0 = tr;
                troj_tab[i] = tr0;
            }

            i = i + 1;
        }


        i = 0;
        int fal = 0;
        int fal0 = 0;
        while (i <= 345)
        {
            if (i == 0)
            {
                if (sinus_tab[i] <= troj_tab[i])
                {
                    fal0 = 185;
                }
                else
                {
                    fal0 = 285;
                }
            }
            else
            {
                if (sinus_tab[i] <= troj_tab[i])
                {
                    fal = 185;

                }
                else
                {
                    fal = 285;

                }
                g1->DrawLine(pioro3, 405 + i - 1, fal0, 405 + i, fal);
                fal0 = fal;
            }

            i = i + 1;
        }

    }



    private: System::Void textBox1_TextChanged(System::Object^  sender, System::EventArgs^  e) {
    }
    private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
    }

    };
}
#pragma一次
名称空间错误结束{
#包括
使用名称空间系统;
使用名称空间System::ComponentModel;
使用名称空间系统::集合;
使用命名空间System::Windows::Forms;
使用名称空间System::Data;
使用名称空间系统::绘图;
/// 
///表格1摘要
///
///警告:如果更改此类的名称,则需要更改
///托管资源编译器工具的“资源文件名”属性
///与该类所依赖的所有.resx文件关联。否则,
///设计人员将无法与本地化的应用程序正确交互
///与此表单关联的资源。
/// 
public ref类Form1:public System::Windows::Forms::Form
{
公众:
表格1(无效)
{
初始化组件();
//
//TODO:在此处添加构造函数代码
//
}
受保护的:
/// 
///清理所有正在使用的资源。
/// 
~Form1()
{
if(组件)
{
删除组件;
}
}
私有:系统::Windows::窗体::标签^label13;
受保护的:
私有:系统::Windows::窗体::标签^label12;
私有:系统::Windows::窗体::按钮^button1;
私有:系统::Windows::窗体::标签^label11;
私有:系统::Windows::窗体::标签^label10;
私有:系统::Windows::窗体::标签^label9;
私有:系统::Windows::窗体::文本框^pred_zadana;
私有:系统::Windows::窗体::标签^label8;
私有:系统::Windows::窗体::标签^label7;
私有:系统::Windows::窗体::文本框^bieguny;
私有:系统::Windows::窗体::标签^label6;
私有:系统::Windows::窗体::文本框^czestotliwosc;
私有:系统::Windows::窗体::标签^label5;
private:System::Windows::Forms::TextBox^predkosc;
私有:系统::Windows::窗体::标签^label4;
私有:系统::Windows::窗体::文本框^napiecie;
私有:系统::Windows::窗体::标签^label3;
private:System::Windows::Forms::TextBox^textBox1;
私有:系统::Windows::窗体::标签^label2;
私有:系统::Windows::窗体::标签^label1;
私有:系统::Windows::窗体::标签^label17;
私有:系统::Windows::窗体::标签^label18;
私有:系统::Windows::窗体::文本框^okres\u amp;
私有:系统::Windows::窗体::标签^label15;
私有:系统::Windows::窗体::标签^label16;
私有:系统::Windows::窗体::标签^label14;
受保护的:
私人:
/// 
///必需的设计器变量。
/// 
系统::组件模型::容器^组件;
#pragma区域Windows窗体设计器生成的代码
/// 
///设计器支持所需的方法-不修改
///此方法的内容与代码编辑器一起使用。
/// 
void初始化组件(void)
{
这->label13=(gcnewsystem::Windows::Forms::Label());
这->label12=(gcnewsystem::Windows::Forms::Label());
此->按钮1=(gcnew System::Windows::Forms::Button());
这->label11=(gcnewsystem::Windows::Forms::Label());
这->label10=(gcnewsystem::Windows::Forms::Label());
这->label9=(gcnewsystem::Windows::Forms::Label());
这->pred_zadana=(gcnew System::Windows::Forms::TextBox());
这->label8=(gcnewsystem::Windows::Forms::Label());
这->label7=(gcnewsystem::Windows::Forms::Label());
this->bieguny=(gcnewsystem::Windows::Forms::TextBox());
这->label6=(gcnewsystem::Windows::Forms::Label());
这->czestotliwosc=(gcnewsystem::Windows::Forms::TextBox());
这->label5=(gcnewsystem::Windows::Forms::Label());
这->predkosc=(gcnewsystem::Windows::Forms::TextBox());
这->label4=(gcnewsystem::Windows::Forms::Label());
这->napiecie=(gcnew System::Windows::Forms::TextBox());
这->label3=(gcnewsystem::Windows::Forms::Label());
这->textBox1=(gcnewsystem::Windows::Forms::TextBox());
这->label2=(gcnewsystem::Windows::Forms::Label());
这->标签1=(gcnewsystem::Windows::Forms::Label());
这->label17=(gcnewsystem::Windows::Forms::Label());
这->label18=(gcnewsystem::Windows::Forms::Label());
这->okres_amp=(gcnew System::Windows::Forms::TextBox());
这->label15=(gcnewsystem::Windows::Forms::Label());
这->label16=(gcnewsystem::Windows::Forms::Label());
这->label14=(gcnewsystem::Windows::Forms::Label());
此->SuspendLayout();
// 
//标签13
// 
此->标签13->自动调整大小=真;
该->标签13->位置=系统::图纸::点(430223);
这->标签13->边距=系统::窗口::窗体::填充(4,0,4,0);
此->label13->名称=L“label13”;
该->标签13->尺寸=系统::图纸::尺寸(49,20);
该->标签13->标签索引=42;
此->标签13->文本=L“……”;
// 
//标签12
// 
此->标签12->自动调整大小=真;
这个->标签12->位置=系统::图纸::点(430185);
这->标签12->边距=系统::窗口::窗体::填充(4,0,4,0);
    int sinus_tab[345];
    while (i <= 345) {
        sinus_tab[i] = 80 - Convert::ToInt32(y0); // tablica elementów sinusa
    }
   array<int>^ sinus_tab = gcnew array<int>(345);