, Visual C#


Visual C++


36.1. .

private: System::Void pictureBox1_Paint(

System::Object^ sender,

System::Windows::Forms::PaintEventArgs^ e)

{

// :

int i, j, k;

// 1- myArrayVC(i, j):

int N_x = 201; int N_y = 2;

// 1- myArrayVC[i, j] float,

// i = 0,1,2,3,...,(N_x - 1);

// j = 0,1,2,3,...,(N_y - 1):

array<float,2>^ myArrayVC =

gcnew array<float,2>(N_x, N_y);

//

// D:\\MyDocs\\MyTest3D_Graphics.txt

// myArrayVC(201, 2)

// sr StreamReader:

StreamReader^ sr = gcnew StreamReader(

"D:\\MyDocs\\MyTest3D_Graphics.txt");

// MyTest3D_Graphics.txt

// myArrayVC(201, 2)

// ReadLine:

for (i = 0; i <= N_x - 1; i++)

for (j = 0; j <= N_y - 1; j++)

myArrayVC[i, j] =

Convert::ToSingle(sr->ReadLine());

sr->Close();

// .

// :

float x1, y1, x2, y2;

// myPen 3 :

Pen^ myPen = gcnew Pen(Color::Black, 3);

// N_first_line

// N_last_line :

int N_first_line, N_last_line;

//

// myArrayVC:

N_first_line = Convert::ToInt32(myArrayVC[0, 0]);

N_last_line = Convert::ToInt32(myArrayVC[0, 1]);

// , (1,0; 1,1):

i = -1;

for (k = N_first_line; k <= N_last_line; k++)

{

i = i + 2;

x1 = myArrayVC[i, 0];

y1 = myArrayVC[i, 1];