Can a ListView fill in values ​​not in a column, but in rows?

The situation is as follows: I need to fill in the values ​​as shown in the figure:

table

For example, the initial condition is 0.01 and it ends on the boundary 1.1 and here are my i1, i2, i3, i4 and you need to fill in the values ​​in the string (from the initial to the final).

I already know how to add columns through a loop:

int kolst =10; listView1->Columns->Add("Начальные условия", -2, HorizontalAlignment::Right); for(int i = 1;i<kolst+1;i++) { listView1->Columns->Add("i + " + i, -2, HorizontalAlignment::Left);//Нумерация столбцов } listView1->Columns->Add("Граничные условия", -2, HorizontalAlignment::Left); 

But how to fill in the values ​​in rows is not clear. I filled the initial and boundary conditions and their expressions as it should, it remains only to fill the expressions from the array into a row, and not into a column (i1, i2, i3, i4). That is, under each i1, i2, I should have an array value. How can this be done?

What I tried to do: I substituted the Items.Add,Columns.Add in the loop, but the line was not displayed.

  • What GUI library are you using? There is no ListView in c ++. - αλεχολυτ
  • @alexolut using Microsoft Visual Studio, Windows Forms - beginner
  • In this case, it is no longer c++ , but c++/cli . - αλεχολυτ

1 answer 1

Remember to replace the values ​​for the start and end columns (InitialValue & RangeBound):

 public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); } System::Windows::Forms::ListView^ listView1; void InitializeComponent(void) { int kolst = 10; this->listView1 = (gcnew System::Windows::Forms::ListView()); this->SuspendLayout(); this->listView1->Columns->Add("Начальные условия", -2, HorizontalAlignment::Right); for(int i = 1;i<kolst+1;i++) { this->listView1->Columns->Add("i + " + i, -2, HorizontalAlignment::Left);//Нумерация столбцов } this->listView1->Columns->Add("Граничные условия", -2, HorizontalAlignment::Left); System::Windows::Forms::ListViewItem^ listViewItemInitial = (gcnew System::Windows::Forms::ListViewItem(L"InitialValue")); System::Windows::Forms::ListViewItem^ listViewItem1 = (gcnew System::Windows::Forms::ListViewItem(L"q1")); System::Windows::Forms::ListViewItem^ listViewItem2 = (gcnew System::Windows::Forms::ListViewItem(L"q2")); System::Windows::Forms::ListViewItem^ listViewItem3 = (gcnew System::Windows::Forms::ListViewItem(L"q3")); System::Windows::Forms::ListViewItem^ listViewItem4 = (gcnew System::Windows::Forms::ListViewItem(L"q4")); System::Windows::Forms::ListViewItem^ listViewItem5 = (gcnew System::Windows::Forms::ListViewItem(L"q5")); System::Windows::Forms::ListViewItem^ listViewItem6 = (gcnew System::Windows::Forms::ListViewItem(L"q6")); System::Windows::Forms::ListViewItem^ listViewItem7 = (gcnew System::Windows::Forms::ListViewItem(L"q7")); System::Windows::Forms::ListViewItem^ listViewItem8 = (gcnew System::Windows::Forms::ListViewItem(L"q8")); System::Windows::Forms::ListViewItem^ listViewItemRangeBound = (gcnew System::Windows::Forms::ListViewItem(L"RangeBound")); this->listView1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ListViewItem^ >(10) {listViewItemInitial, listViewItem1, listViewItem2, listViewItem3, listViewItem4, listViewItem5, listViewItem6, listViewItem7, listViewItem8, listViewItemRangeBound}); } }