fork download
  1. #pragma once
  2.  
  3. namespace CppWinForm1 {
  4. using namespace System;
  5. using namespace System::ComponentModel;
  6. using namespace System::Collections;
  7. using namespace System::Windows::Forms;
  8. using namespace System::Drawing;
  9.  
  10. public ref class MyForm : public System::Windows::Forms::Form
  11. {
  12. public:
  13. MyForm(void)
  14. {
  15. InitializeComponent();
  16. }
  17. protected:
  18. ~MyForm()
  19. {
  20. if (components)
  21. {
  22. delete components;
  23. }
  24. }
  25. private: System::Windows::Forms::Button^ button1;
  26. private: System::Windows::Forms::Timer^ timer1;
  27. private: System::Windows::Forms::DataVisualization::Charting::Chart^ chart1;
  28. private: System::ComponentModel::IContainer^ components;
  29.  
  30. private:
  31. int i, j;
  32. int maxI = 50;
  33. int maxJ = 5;
  34.  
  35. #pragma region Windows Form Designer generated code
  36. void InitializeComponent(void)
  37. {
  38. this->components = (gcnew System::ComponentModel::Container());
  39. System::Windows::Forms::DataVisualization::Charting::ChartArea^ chartArea2 = (gcnew System::Windows::Forms::DataVisualization::Charting::ChartArea());
  40. System::Windows::Forms::DataVisualization::Charting::Legend^ legend2 = (gcnew System::Windows::Forms::DataVisualization::Charting::Legend());
  41. System::Windows::Forms::DataVisualization::Charting::Series^ series2 = (gcnew System::Windows::Forms::DataVisualization::Charting::Series());
  42. this->button1 = (gcnew System::Windows::Forms::Button());
  43. this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
  44. this->chart1 = (gcnew System::Windows::Forms::DataVisualization::Charting::Chart());
  45. (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->chart1))->BeginInit();
  46. this->SuspendLayout();
  47. //
  48. // button1
  49. //
  50. this->button1->Location = System::Drawing::Point(225, 338);
  51. this->button1->Name = L"button1";
  52. this->button1->Size = System::Drawing::Size(75, 23);
  53. this->button1->TabIndex = 0;
  54. this->button1->Text = L"button1";
  55. this->button1->UseVisualStyleBackColor = true;
  56. this->button1->Click += gcnew System::EventHandler(this, &MyForm::button1_Click);
  57. //
  58. // timer1
  59. //
  60. this->timer1->Tick += gcnew System::EventHandler(this, &MyForm::timer1_Tick);
  61. //
  62. // chart1
  63. //
  64. chartArea2->Name = L"ChartArea1";
  65. this->chart1->ChartAreas->Add(chartArea2);
  66. legend2->Name = L"Legend1";
  67. this->chart1->Legends->Add(legend2);
  68. this->chart1->Location = System::Drawing::Point(0, 0);
  69. this->chart1->Name = L"chart1";
  70. series2->ChartArea = L"ChartArea1";
  71. series2->ChartType = System::Windows::Forms::DataVisualization::Charting::SeriesChartType::Line;
  72. series2->Legend = L"Legend1";
  73. series2->Name = L"Series1";
  74. this->chart1->Series->Add(series2);
  75. this->chart1->Size = System::Drawing::Size(300, 300);
  76. this->chart1->TabIndex = 1;
  77. this->chart1->Text = L"chart1";
  78. //
  79. // MyForm
  80. //
  81. this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
  82. this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
  83. this->ClientSize = System::Drawing::Size(322, 373);
  84. this->Controls->Add(this->chart1);
  85. this->Controls->Add(this->button1);
  86. this->Name = L"MyForm";
  87. this->Text = L"MyForm";
  88. (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->chart1))->EndInit();
  89. this->ResumeLayout(false);
  90.  
  91. }
  92. #pragma endregion
  93. private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
  94. chart1->Series["Series1"]->Color = Color::Red;
  95. chart1->Series["Series1"]->BorderWidth = 5;
  96.  
  97. i = 1;
  98. j = 1;
  99. timer1->Start();
  100. }
  101. private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) {
  102. chart1->Series["Series1"]->Points->AddXY(i, j);
  103.  
  104. i++;
  105. if (i == maxI)
  106. {
  107. i = 1;
  108. j++;
  109. if (j == maxJ)
  110. timer1->Stop();
  111. }
  112. }
  113. };
  114. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(2,0): warning CS1633: Unrecognized #pragma directive
prog.cs(4,7): error CS1525: Unexpected symbol `namespace', expecting `identifier' or `static'
prog.cs(4,23): error CS1525: Unexpected symbol `;', expecting `identifier' or `static'
prog.cs(5,16): error CS1514: Unexpected symbol `namespace', expecting `.' or `{'
prog.cs(5,23): error CS1525: Unexpected symbol `::', expecting `identifier' or `static'
prog.cs(6,16): error CS1514: Unexpected symbol `namespace', expecting `.' or `{'
prog.cs(6,23): error CS1525: Unexpected symbol `::', expecting `identifier' or `static'
prog.cs(7,16): error CS1514: Unexpected symbol `namespace', expecting `.' or `{'
prog.cs(7,23): error CS1525: Unexpected symbol `::', expecting `identifier' or `static'
prog.cs(8,16): error CS1514: Unexpected symbol `namespace', expecting `.' or `{'
prog.cs(8,23): error CS1525: Unexpected symbol `::', expecting `identifier' or `static'
prog.cs(10,7): error CS1514: Unexpected symbol `public', expecting `.' or `{'
prog.cs(10,8): error CS1525: Unexpected symbol `ref', expecting `identifier' or `static'
prog.cs(10,17): error CS1514: Unexpected symbol `class', expecting `.' or `{'
prog.cs(10,27): error CS1525: Unexpected symbol `public', expecting `type'
prog.cs(35,15): warning CS1633: Unrecognized #pragma directive
prog.cs(93,0): warning CS1633: Unrecognized #pragma directive
Compilation failed: 14 error(s), 3 warnings
stdout
Standard output is empty