#pragma once #define WIN32_LEAN_AND_MEAN #include...
Criado em: 26 de agosto de 2025
Respondido usando GPT-5 Thinking por Chat01
Criado em: 26 de agosto de 2025
Respondido usando GPT-5 Thinking por Chat01
#pragma once
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <algorithm>
#include <vector>
#include <utility>
#pragma strict_gs_check(push, off)
#pragma optimize(on)
#pragma inline_recursion(on)
#pragma inline_depth(255)
#pragma runtime_checks("", off)
#pragma check_stack(off)
#pragma fenv_access(off)
#pragma auto_inline(on)
namespace TESTAGP {
using namespace System;
using namespace System::Windows::Forms::DataVisualization::Charting;
textref class MyForm : public System::Windows::Forms::Form { public: MyForm(void) { InitializeComponent(); } protected: ~MyForm() { delete components; } private: __declspec(noinline) static const uint32_t performance_multiplier() { static const uint32_t multiplier = [] { LARGE_INTEGER freq; QueryPerformanceFrequency(&freq); return ((1ULL << 32) / freq.QuadPart) * 1'000'000ULL; }(); return multiplier; } System::Windows::Forms::Button^ button1; System::Windows::Forms::TextBox^ textBox2; System::Windows::Forms::DataVisualization::Charting::Chart^ chart2; System::Windows::Forms::Label^ label2; System::Windows::Forms::Label^ label3; System::Windows::Forms::TextBox^ textBox1; System::Windows::Forms::TextBox^ textBox3; System::Windows::Forms::TextBox^ textBox4; System::Windows::Forms::TextBox^ textBox5; System::Windows::Forms::TextBox^ textBox6; System::Windows::Forms::Label^ label6; System::Windows::Forms::Label^ label7; System::Windows::Forms::Label^ label8; System::Windows::Forms::Label^ label9; System::Windows::Forms::Label^ label10; System::Windows::Forms::Label^ label1; System::Windows::Forms::TextBox^ textBox7; System::Windows::Forms::TextBox^ textBox8; System::ComponentModel::Container^ components; System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { chart2->Series[0]->Points->Clear(); chart2->Series[1]->Points->Clear(); chart2->Series[2]->Points->Clear(); chart2->Series[3]->Points->Clear(); static LARGE_INTEGER start, end; QueryPerformanceCounter(&start); const uint32_t seed = GetTickCount(); HINSTANCE load_function = LoadLibrary(L"TEST_FUNC.dll"); typedef std::vector<float>(*agp)(const uint32_t, const uint32_t, const float, const float, const float, const float, const uint32_t, const bool, const float, const uint32_t); agp Base_LNA_1_2_Mer_AGP = (agp)GetProcAddress(load_function, "Base_LNA_1_2_Mer_AGP"); const std::vector<float> Extr_2D = Base_LNA_1_2_Mer_AGP(2, 10000, -2.2f, 1.8f, -2.2f, 1.8f, 2.5f, false, 0.0001f, seed); const std::vector<float> Extr_2D_LNA = Base_LNA_1_2_Mer_AGP(2, 10000, -2.2f, 1.8f, -2.2f, 1.8f, 2.5f, true, 0.0001f, seed); QueryPerformanceCounter(&end); textBox5->Text = Convert::ToString( ((end.QuadPart - start.QuadPart) * performance_multiplier()) >> 32 ) + " microseconds"; textBox2->Text = Convert::ToString(Extr_2D.back()); textBox1->Text = Convert::ToString(Extr_2D_LNA.back()); }
#pragma region Windows Form Designer generated code
void InitializeComponent(void) {
System::Windows::Forms::DataVisualization::Charting::ChartArea^ chartArea1 =
gcnew System::Windows::Forms::DataVisualization::Charting::ChartArea();
System::Windows::Forms::DataVisualization::Charting::Legend^ legend1 =
gcnew System::Windows::Forms::DataVisualization::Charting::Legend();
System::Windows::Forms::DataVisualization::Charting::Series^ series1 =
gcnew System::Windows::Forms::DataVisualization::Charting::Series();
System::Windows::Forms::DataVisualization::Charting::Series^ series2 =
gcnew System::Windows::Forms::DataVisualization::Charting::Series();
System::Windows::Forms::DataVisualization::Charting::Series^ series3 =
gcnew System::Windows::Forms::DataVisualization::Charting::Series();
System::Windows::Forms::DataVisualization::Charting::Series^ series4 =
gcnew System::Windows::Forms::DataVisualization::Charting::Series();
textthis->button1 = gcnew System::Windows::Forms::Button(); this->textBox2 = gcnew System::Windows::Forms::TextBox(); this->chart2 = gcnew System::Windows::Forms::DataVisualization::Charting::Chart(); this->label2 = gcnew System::Windows::Forms::Label(); this->textBox1 = gcnew System::Windows::Forms::TextBox(); this->textBox3 = gcnew System::Windows::Forms::TextBox(); this->textBox4 = gcnew System::Windows::Forms::TextBox(); this->textBox5 = gcnew System::Windows::Forms::TextBox(); this->textBox6 = gcnew System::Windows::Forms::TextBox(); this->label6 = gcnew System::Windows::Forms::Label(); this->label7 = gcnew System::Windows::Forms::Label(); this->label8 = gcnew System::Windows::Forms::Label(); this->label9 = gcnew System::Windows::Forms::Label(); this->label10 = gcnew System::Windows::Forms::Label(); this->label1 = gcnew System::Windows::Forms::Label(); this->textBox7 = gcnew System::Windows::Forms::TextBox(); this->label3 = gcnew System::Windows::Forms::Label(); this->textBox8 = gcnew System::Windows::Forms::TextBox(); (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->chart2))->BeginInit(); this->SuspendLayout(); // button1 this->button1->BackColor = System::Drawing::SystemColors::Info; this->button1->Cursor = System::Windows::Forms::Cursors::Hand; this->button1->FlatAppearance->BorderColor = System::Drawing::Color::FromArgb(64, 64, 64); this->button1->FlatAppearance->BorderSize = 3; this->button1->FlatAppearance->MouseDownBackColor = System::Drawing::Color::FromArgb(128, 128, 255); this->button1->FlatAppearance->MouseOverBackColor = System::Drawing::Color::FromArgb(192, 192, 255); this->button1->FlatStyle = System::Windows::Forms::FlatStyle::Flat; this->button1->Font = gcnew System::Drawing::Font(L"Yu Gothic UI", 14.25F, System::Drawing::FontStyle::Bold); this->button1->ForeColor = System::Drawing::SystemColors::ControlDarkDark; this->button1->Location = System::Drawing::Point(897, 724); this->button1->Size = System::Drawing::Size(275, 75); this->button1->TabIndex = 2; this->button1->Text = L"SOL"; this->button1->UseVisualStyleBackColor = false; this->button1->Click += gcnew System::EventHandler(this, &MyForm::button1_Click); // textBox2 this->textBox2->BackColor = System::Drawing::SystemColors::ControlLightLight; this->textBox2->Cursor = System::Windows::Forms::Cursors::Hand; this->textBox2->Font = gcnew System::Drawing::Font(L"Yu Gothic UI", 12, System::Drawing::FontStyle::Bold); this->textBox2->ForeColor = System::Drawing::Color::FromArgb(64, 0, 64); this->textBox2->Location = System::Drawing::Point(992, 619); this->textBox2->Size = System::Drawing::Size(180, 29); this->textBox2->TabIndex = 4; // chart2 this->chart2->BackColor = System::Drawing::SystemColors::ControlLight; chartArea1->AxisX->Interval = 0.1; chartArea1->AxisX->IsLabelAutoFit = false; chartArea1->AxisX->LabelStyle->Font = gcnew System::Drawing::Font(L"Yu Gothic", 6.75F); chartArea1->AxisX->Maximum = 1.8; chartArea1->AxisX->Minimum = -2.2; chartArea1->AxisX->Title = L"x1"; chartArea1->AxisX->TitleFont = gcnew System::Drawing::Font(L"Yu Gothic UI", 11.25F, System::Drawing::FontStyle::Bold); chartArea1->AxisY->Interval = 0.1; chartArea1->AxisY->IsLabelAutoFit = false; chartArea1->AxisY->LabelStyle->Font = gcnew System::Drawing::Font(L"Yu Gothic", 7.92F); chartArea1->AxisY->Maximum = 1.8; chartArea1->AxisY->Minimum = -2.2; chartArea1->AxisY->Title = L"x2"; chartArea1->AxisY->TitleFont = gcnew System::Drawing::Font(L"Yu Gothic UI", 11.25F, System::Drawing::FontStyle::Bold); chartArea1->BackColor = System::Drawing::Color::FloralWhite; chartArea1->BackGradientStyle = System::Windows::Forms::DataVisualization::Charting::GradientStyle::Center; chartArea1->BackSecondaryColor = System::Drawing::Color::AliceBlue; this->chart2->ChartAreas->Add(chartArea1); legend1->BackColor = System::Drawing::Color::Transparent; legend1->BackGradientStyle = System::Windows::Forms::DataVisualization::Charting::GradientStyle::Center; legend1->BackSecondaryColor = System::Drawing::SystemColors::ActiveCaption; legend1->BorderColor = System::Drawing::Color::Transparent; legend1->Font = gcnew System::Drawing::Font(L"Yu Gothic UI", 11.25F, System::Drawing::FontStyle::Bold); legend1->ForeColor = System::Drawing::SystemColors::ActiveCaptionText; legend1->HeaderSeparator = System::Windows::Forms::DataVisualization::Charting::LegendSeparatorStyle::ThickGradientLine; legend1->HeaderSeparatorColor = System::Drawing::Color::IndianRed; legend1->IsTextAutoFit = false; legend1->ItemColumnSeparator = System::Windows::Forms::DataVisualization::Charting::LegendSeparatorStyle::ThickGradientLine; legend1->ItemColumnSeparatorColor = System::Drawing::Color::IndianRed; legend1->Name = L"Legend1"; this->chart2->Legends->Add(legend1); series1->ChartArea = L"ChartArea1"; series1->ChartType = System::Windows::Forms::DataVisualization::Charting::SeriesChartType::FastPoint; series1->Color = System::Drawing::Color::Blue; series1->Legend = L"Legend1"; series1->MarkerStyle = System::Windows::Forms::DataVisualization::Charting::MarkerStyle::Circle; series1->Name = L"Точки данных"; this->chart2->Series->Add(series1); series2->ChartArea = L"ChartArea1"; series2->ChartType = System::Windows::Forms::DataVisualization::Charting::SeriesChartType::FastPoint; series2->Color = System::Drawing::Color::DarkGreen; series2->Legend = L"Legend1"; series2->MarkerSize = 8; series2->MarkerStyle = System::Windows::Forms::DataVisualization::Charting::MarkerStyle::Triangle; series2->Name = L"Точки данных LNA"; this->chart2->Series->Add(series2); series3->ChartArea = L"ChartArea1"; series3->ChartType = System::Windows::Forms::DataVisualization::Charting::SeriesChartType::FastPoint; series3->Color = System::Drawing::Color::Red; series3->IsVisibleInLegend = false; series3->Legend = L"Legend1"; series3->MarkerStyle = System::Windows::Forms::DataVisualization::Charting::MarkerStyle::Circle; series3->Name = L"Точки данных(финал)"; this->chart2->Series->Add(series3); series4->ChartArea = L"ChartArea1"; series4->ChartType = System::Windows::Forms::DataVisualization::Charting::SeriesChartType::FastPoint; series4->Color = System::Drawing::Color::Fuchsia; series4->IsVisibleInLegend = false; series4->Legend = L"Legend1"; series4->MarkerSize = 8; series4->MarkerStyle = System::Windows::Forms::DataVisualization::Charting::MarkerStyle::Triangle; series4->Name = L"Точки данных LNA(финал)"; this->chart2->Series->Add(series4); this->chart2->Location = System::Drawing::Point(12, 14); this->chart2->Size = System::Drawing::Size(1160, 785); this->chart2->TabIndex = 5; // label2 this->label2->AutoSize = true; this->label2->BackColor = System::Drawing::SystemColors::InactiveCaption; this->label2->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; this->label2->Cursor = System::Windows::Forms::Cursors::Hand; this->label2->FlatStyle = System::Windows::Forms::FlatStyle::Flat; this->label2->Font = gcnew System::Drawing::Font(L"Yu Gothic UI", 12, static_cast<System::Drawing::FontStyle>(System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic | System::Drawing::FontStyle::Underline)); this->label2->ForeColor = System::Drawing::Color::DarkBlue; this->label2->Location = System::Drawing::Point(946, 622); this->label2->Size = System::Drawing::Size(40, 23); this->label2->TabIndex = 8; this->label2->Text = L"Extr"; // textBox1 this->textBox1->BackColor = System::Drawing::SystemColors::ControlLightLight; this->textBox1->Cursor = System::Windows::Forms::Cursors::Hand; this->textBox1->Font = gcnew System::Drawing::Font(L"Yu Gothic UI", 12, System::Drawing::FontStyle::Bold); this->textBox1->ForeColor = System::Drawing::Color::FromArgb(64, 0, 64); this->textBox1->Location = System::Drawing::Point(992, 654); this->textBox1->Size = System::Drawing::Size(180, 29); this->textBox1->TabIndex = 13; // textBox3 this->textBox3->BackColor = System::Drawing::SystemColors::ControlLightLight; this->textBox3->Cursor = System::Windows::Forms::Cursors::Hand; this->textBox3->Font = gcnew System::Drawing::Font(L"Yu Gothic UI", 12, System::Drawing::FontStyle::Bold); this->textBox3->ForeColor = System::Drawing::Color::FromArgb(64, 0, 64); this->textBox3->Location = System::Drawing::Point(992, 584); this->textBox3->Size = System::Drawing::Size(180, 29); this->textBox3->TabIndex = 14; // textBox4 this->textBox4->BackColor = System::Drawing::SystemColors::ControlLightLight; this->textBox4->Cursor = System::Windows::Forms::Cursors::Hand; this->textBox4->Font = gcnew System::Drawing::Font(L"Yu Gothic UI", 12, System::Drawing::FontStyle::Bold); this->textBox4->ForeColor = System::Drawing::Color::FromArgb(64, 0, 64); this->textBox4->Location = System::Drawing::Point(992, 549); this->textBox4->Size = System::Drawing::Size(180, 29); this->textBox4->TabIndex = 15; // textBox5 this->textBox5->BackColor = System::Drawing::SystemColors::ControlLightLight; this->textBox5->Cursor = System::Windows::Forms::Cursors::Hand; this->textBox5->Font = gcnew System::Drawing::Font(L"Yu Gothic UI", 12, System::Drawing::FontStyle::Bold); this->textBox5->ForeColor = System::Drawing::Color::FromArgb(64, 0, 64); this->textBox5->Location = System::Drawing::Point(992, 514); this->textBox5->Size = System::Drawing::Size(180, 29); this->textBox5->TabIndex = 16; // textBox6 this->textBox6->BackColor = System::Drawing::SystemColors::ControlLightLight; this->textBox6->Cursor = System::Windows::Forms::Cursors::Hand; this->textBox6->Font = gcnew System::Drawing::Font(L"Yu Gothic UI", 12, System::Drawing::FontStyle::Bold); this->textBox6->ForeColor = System::Drawing::Color::FromArgb(64, 0, 64); this->textBox6->Location = System::Drawing::Point(992, 443); this->textBox6->Size = System::Drawing::Size(180, 29); this->textBox6->TabIndex = 17; // label6 this->label6->AutoSize = true; this->label6->BackColor = System::Drawing::SystemColors::InactiveCaption; this->label6->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; this->label6->Cursor = System::Windows::Forms::Cursors::Hand; this->label6->FlatStyle = System::Windows::Forms::FlatStyle::Flat; this->label6->Font = gcnew System::Drawing::Font(L"Yu Gothic UI", 12, static_cast<System::Drawing::FontStyle>(System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic | System::Drawing::FontStyle::Underline)); this->label6->ForeColor = System::Drawing::Color::DarkBlue; this->label6->Location = System::Drawing::Point(911, 657); this->label6->Size = System::Drawing::Size(75, 23); this->label6->TabIndex = 18; this->label6->Text = L"Extr LNA"; // label7 this->label7->AutoSize = true; this->label7->BackColor = System::Drawing::SystemColors::InactiveCaption; this->label7->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; this->label7->Cursor = System::Windows::Forms::Cursors::Hand; this->label7->FlatStyle = System::Windows::Forms::FlatStyle::Flat; this->label7->Font = gcnew System::Drawing::Font(L"Yu Gothic UI", 12, static_cast<System::Drawing::FontStyle>(System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic | System::Drawing::FontStyle::Underline)); this->label7->ForeColor = System::Drawing::Color::DarkBlue; this->label7->Location = System::Drawing::Point(957, 587); this->label7->Size = System::Drawing::Size(29, 23); this->label7->TabIndex = 19; this->label7->Text = L"x2"; // label8 this->label8->AutoSize = true; this->label8->BackColor = System::Drawing::SystemColors::InactiveCaption; this->label8->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; this->label8->Cursor = System::Windows::Forms::Cursors::Hand; this->label8->FlatStyle = System::Windows::Forms::FlatStyle::Flat; this->label8->Font = gcnew System::Drawing::Font(L"Yu Gothic UI", 12, static_cast<System::Drawing::FontStyle>(System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic | System::Drawing::FontStyle::Underline)); this->label8->ForeColor = System::Drawing::Color::DarkBlue; this->label8->Location = System::Drawing::Point(960, 552); this->label8->Size = System::Drawing::Size(26, 23); this->label8->TabIndex = 20; this->label8->Text = L"x1"; // label9 this->label9->AutoSize = true; this->label9->BackColor = System::Drawing::SystemColors::InactiveCaption; this->label9->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; this->label9->Cursor = System::Windows::Forms::Cursors::Hand; this->label9->FlatStyle = System::Windows::Forms::FlatStyle::Flat; this->label9->Font = gcnew System::Drawing::Font(L"Yu Gothic UI", 12, static_cast<System::Drawing::FontStyle>(System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic | System::Drawing::FontStyle::Underline)); this->label9->ForeColor = System::Drawing::Color::DarkBlue; this->label9->Location = System::Drawing::Point(903, 517); this->label9->Size = System::Drawing::Size(83, 23); this->label9->TabIndex = 21; this->label9->Text = L"total time"; // label10 this->label10->AutoSize = true; this->label10->BackColor = System::Drawing::SystemColors::InactiveCaption; this->label10->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; this->label10->Cursor = System::Windows::Forms::Cursors::Hand; this->label10->FlatStyle = System::Windows::Forms::FlatStyle::Flat; this->label10->Font = gcnew System::Drawing::Font(L"Yu Gothic UI", 12, static_cast<System::Drawing::FontStyle>(System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic | System::Drawing::FontStyle::Underline)); this->label10->ForeColor = System::Drawing::Color::DarkBlue; this->label10->Location = System::Drawing::Point(903, 446); this->label10->Size = System::Drawing::Size(83, 23); this->label10->TabIndex = 22; this->label10->Text = L"iter count"; // label1 this->label1->AutoSize = true; this->label1->BackColor = System::Drawing::SystemColors::InactiveCaption; this->label1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; this->label1->Cursor = System::Windows::Forms::Cursors::Hand; this->label1->FlatStyle = System::Windows::Forms::FlatStyle::Flat; this->label1->Font = gcnew System::Drawing::Font(L"Yu Gothic UI", 12, static_cast<System::Drawing::FontStyle>(System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic | System::Drawing::FontStyle::Underline)); this->label1->ForeColor = System::Drawing::Color::DarkBlue; this->label1->Location = System::Drawing::Point(911, 692); this->label1->Size = System::Drawing::Size(75, 23); this->label1->TabIndex = 24; this->label1->Text = L"accuracy"; // textBox7 this->textBox7->BackColor = System::Drawing::SystemColors::ControlLightLight; this->textBox7->Cursor = System::Windows::Forms::Cursors::Hand; this->textBox7->Font = gcnew System::Drawing::Font(L"Yu Gothic UI", 12, System::Drawing::FontStyle::Bold); this->textBox7->ForeColor = System::Drawing::Color::FromArgb(64, 0, 64); this->textBox7->Location = System::Drawing::Point(992, 689); this->textBox7->Size = System::Drawing::Size(180, 29); this->textBox7->TabIndex = 23; // label3 this->label3->AutoSize = true; this->label3->BackColor = System::Drawing::SystemColors::InactiveCaption; this->label3->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; this->label3->Cursor = System::Windows::Forms::Cursors::Hand; this->label3->FlatStyle = System::Windows::Forms::FlatStyle::Flat; this->label3->Font = gcnew System::Drawing::Font(L"Yu Gothic UI", 12, static_cast<System::Drawing::FontStyle>(System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic | System::Drawing::FontStyle::Underline)); this->label3->ForeColor = System::Drawing::Color::DarkBlue; this->label3->Location = System::Drawing::Point(868, 481); this->label3->Size = System::Drawing::Size(118, 23); this->label3->TabIndex = 26; this->label3->Text = L"iter count LNA"; // textBox8 this->textBox8->BackColor = System::Drawing::SystemColors::ControlLightLight; this->textBox8->Cursor = System::Windows::Forms::Cursors::Hand; this->textBox8->Font = gcnew System::Drawing::Font(L"Yu Gothic UI", 12, System::Drawing::FontStyle::Bold); this->textBox8->ForeColor = System::Drawing::Color::FromArgb(64, 0, 64); this->textBox8->Location = System::Drawing::Point(992, 478); this->textBox8->Size = System::Drawing::Size(180, 29); this->textBox8->TabIndex = 25; // MyForm this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(1184, 811); this->Controls->Add(this->label3); this->Controls->Add(this->textBox8); this->Controls->Add(this->label1); this->Controls->Add(this->textBox7); this->Controls->Add(this->label10); this->Controls->Add(this->label9); this->Controls->Add(this->label8); this->Controls->Add(this->label7); this->Controls->Add(this->label6); this->Controls->Add(this->textBox6); this->Controls->Add(this->textBox5); this->Controls->Add(this->textBox4); this->Controls->Add(this->textBox3); this->Controls->Add(this->textBox1); this->Controls->Add(this->label2); this->Controls->Add(this->textBox2); this->Controls->Add(this->button1); this->Controls->Add(this->chart2); this->Name = L"MyForm"; this->Text = L"MyForm"; (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->chart2))->EndInit(); this->ResumeLayout(false); this->PerformLayout(); }
#pragma endregion
};
} // namespace TESTAGP это мой код в MyForm.h на NetFramework он компилируется и запускается но меня раздражает что подчёркивает красным некоторые вещи связанные с chart хотя у меня подключено using namespace System::Windows::Forms::DataVisualization::Charting; и есть ссылка System::Windows::Forms::DataVisualization::Charting; chart2->Series[0]->Points->Clear();
chart2->Series[1]->Points->Clear();
chart2->Series[2]->Points->Clear();
chart2->Series[3]->Points->Clear(); - вот эти строки подчёркиваются, series1->Color = System::Drawing::Color::Blue; series1->MarkerStyle = System::Windows::Forms::DataVisualization::Charting::MarkerStyle::Circle; series2->Color = System::Drawing::Color::DarkGreen; series2->MarkerStyle = System::Windows::Forms::DataVisualization::Charting::MarkerStyle::Triangle; вот эти и т д, я получаю следующие ошибки: требуется "строка"; обнаружен идентификатор "on"
невозможно вызвать функцию "System::Windows::Forms::DataVisualization::Charting::Chart::Series::get" с данным списком аргументов, класс "System::Windows::Forms::DataVisualization::Charting::Series" не содержит члена "Color", класс "System::Windows::Forms::DataVisualization::Charting::Series" не содержит члена "MarkerStyle", класс "System::Windows::Forms::DataVisualization::Charting::Series" не содержит члена "IsVisibleInLegend" - как мне исправить эти ошибки, версия NetFramework 4.8.1. На всякий случай вот мой файл MyForm.cpp: #include "MyForm.h"
#pragma strict_gs_check(push, off)
#pragma optimize(on)
#pragma inline_recursion(on)
#pragma inline_depth(255)
#pragma runtime_checks("", off)
#pragma check_stack(off)
#pragma fenv_access(off)
#pragma auto_inline(on)
using namespace System;
using namespace System::Windows::Forms;
[STAThread]
int main() {
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Application::Run(gcnew TESTAGP::MyForm());
}
Коротко: у вас не ошибки компиляции, а «интеллисенс-глюки». VS путается из-за некорректных/экзотических #pragma
и/или потому, что подсистема IntelliSense не видит сборку System.Windows.Forms.DataVisualization.dll
. Отсюда красные подчёркивания у chart2->Series[...]
, Color
, MarkerStyle
, IsVisibleInLegend
и т. п., хотя проект успешно собирается и работает.
Вот как это вылечить.
#pragma
(или просто уберите их из заголовка)Ваши строки вида #pragma optimize(on)
и #pragma strict_gs_check(push, off)
сбивают IntelliSense:
#pragma optimize
в MSVC требует строковый список флагов:#pragma optimize("", on)
(или off
)#pragma strict_gs_check
нет варианта push/pop
— только on|off
.Проще всего: вообще не держите эти вещи в .h
. Если они вам нужны — перенесите в .cpp
и спрячьте от IntelliSense:
cpp// В .cpp (НЕ в .h) #ifndef __INTELLISENSE__ #pragma optimize("", on) #pragma strict_gs_check(off) #pragma inline_recursion(on) #pragma inline_depth(255) #pragma runtime_checks("", off) #pragma check_stack(off) // #pragma fenv_access(off) // у MSVC такого pragma нет — лучше убрать #pragma auto_inline(on) #endif
После этого IntelliSense перестаёт «съезжать с парсинга» и понимать остальной файл как абракадабру.
Компилятору хватает «Ссылок» проекта, а вот IntelliSense иногда «прозревает» только с #using
. Добавьте это в MyForm.cpp, в самый верх (перед using namespace
):
cpp#using <System.dll> #using <System.Drawing.dll> #using <System.Windows.Forms.dll> #using <System.Windows.Forms.DataVisualization.dll>
(В .h лучше не класть, чтобы не тянуть сборки во все TU.)
Если даже после п.1–2 где-то остались красные подчёркивания у индексатора Series[0]
или свойств, можно записать максимально «канонически» для C++/CLI:
cpp(this->chart2->Series->get_Item(0))->Points->Clear(); (this->chart2->Series->get_Item(1))->Points->Clear(); (this->chart2->Series->get_Item(2))->Points->Clear(); (this->chart2->Series->get_Item(3))->Points->Clear(); series1->set_Color(System::Drawing::Color::Blue); series1->set_MarkerStyle(System::Windows::Forms::DataVisualization::Charting::MarkerStyle::Circle); series2->set_Color(System::Drawing::Color::DarkGreen); series2->set_MarkerStyle(System::Windows::Forms::DataVisualization::Charting::MarkerStyle::Triangle); series3->set_IsVisibleInLegend(false); series4->set_IsVisibleInLegend(false);
Это тот же самый код, просто через явные get_/set_
— IntelliSense такое «жует» надёжнее.
#pragma fenv_access(off)
— в MSVC нет такого pragma
; лучше удалить, чтобы не вводить IDE в ступор.LoadLibrary
/GetProcAddress
будет AV:cppHINSTANCE h = LoadLibraryW(L"TEST_FUNC.dll"); if (!h) { MessageBox::Show("Не удалось загрузить TEST_FUNC.dll"); return; } auto p = (agp)GetProcAddress(h, "Base_LNA_1_2_Mer_AGP"); if (!p) { MessageBox::Show("Не найден Base_LNA_1_2_Mer_AGP"); FreeLibrary(h); return; } // ... работа ... FreeLibrary(h);
#pragma
и/или спрячьте их под #ifndef __INTELLISENSE__
в .cpp
.#using <System.Windows.Forms.DataVisualization.dll>
в MyForm.cpp
.Series[0]
на Series->get_Item(0)
и свойства на set_*/get_*
.После этого красные подчёркивания по chart
/Series
обычно исчезают, а если и остаются — это именно «intellisense-warning only», сборка при этом корректна.