, Visual C#


- 3


// myArrayVB(i, j) VB

// myArrayVC[i, j] VC:

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

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

myArrayVC[i, j] =

Convert.ToSingle(myArray.GetValue(i,j));

// .

// :

float x1, y1, x2, y2;

// myPen 3:

Pen myPen = new Pen(Color.Black, 3);

// , myArrayVC[i, j]:

x1 = myArrayVC[0, 0];

y1 = myArrayVC[0, 1];

x2 = myArrayVC[1, 0];

y2 = myArrayVC[1, 1];

e.Graphics.DrawLine(myPen, x1, y1, x2, y2);

x1 = x2; y1 = y2;

x2 = myArrayVC[2, 0]; y2 = myArrayVC[2, 1];

e.Graphics.DrawLine(myPen, x1, y1, x2, y2);

x1 = x2; y1 = y2;

x2 = myArrayVC[3, 0]; y2 = myArrayVC[3, 1];

e.Graphics.DrawLine(myPen, x1, y1, x2, y2);

}

43.4.

pictureBox1_Paint .

private:

System::Void pictureBox1_Paint(System::Object^ sender,

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

{

// myObject Class1 VB:

ComponentVB::Class1^ myObject =

gcnew ComponentVB::Class1();

// myArrayVC(i, j):

int i, j;

// myArrayVC(i, j):

int N_x = 2001; int N_y = 2;

// 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);

// myArray Array

// myFunction1,

// myArrayVB[i, j] VB:

Array^ myArray = (Array^)myObject->myFunction1();

// myArrayVB(i, j) VB

// myArrayVC[i, j] VC:

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

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

myArrayVC[i, j] =

Convert::ToSingle(myArray->GetValue(i,j));

// .

// :

float x1, y1, x2, y2;

// myPen 3:

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

// , myArrayVC[i, j]:

x1 = myArrayVC[0, 0];

y1 = myArrayVC[0, 1];

x2 = myArrayVC[1, 0];

y2 = myArrayVC[1, 1];

e->Graphics->DrawLine(myPen, x1, y1, x2, y2);

x1 = x2; y1 = y2;

x2 = myArrayVC[2, 0]; y2 = myArrayVC[2, 1];

e->Graphics->DrawLine(myPen, x1, y1, x2, y2);

x1 = x2; y1 = y2;

x2 = myArrayVC[3, 0]; y2 = myArrayVC[3, 1];

e->Graphics->DrawLine(myPen, x1, y1, x2, y2);

}





- -  - -  - -