, Visual C#


- 5


// sw StreamWriter

// D:\MyDocs\MyTest.txt.

// :

StreamWriter sw =

new StreamWriter("D:\\MyDocs\\MyTest.txt");

// myArrayVCsharp[i, j]

// WriteLine:

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

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

sw.WriteLine(myArrayVCsharp[i, j]);

sw.Close();

}// pictureBox1_Paint.

, (, ) , Properties ( PictureBox) Events ProcessCmdKey, . , ( ) .

37.3. ProcessCmdKey .

protected override bool ProcessCmdKey(

ref System.Windows.Forms.Message msg,

System.Windows.Forms.Keys keyData)

{

// :

const double delta_theta = Math.PI / 32;

const double delta_phi = Math.PI / 16;

// - - (spherical coordinates)

// :

double theta = Math.Atan2(myEye.orig_coord[1],

myEye.orig_coord[0]);

double r1 = Math.Sqrt(myEye.orig_coord[0] *

myEye.orig_coord[0]

+ myEye.orig_coord[1] * myEye.orig_coord[1]);

double r2 = Math.Sqrt(myEye.orig_coord[0] *

myEye.orig_coord[0]

+ myEye.orig_coord[1] * myEye.orig_coord[1] +

myEye.orig_coord[2] * myEye.orig_coord[2]);

double phi = Math.Atan2(myEye.orig_coord[2], r1);

// phi theta:

switch (keyData)

{

case Keys.Left:

theta = theta - delta_theta;

break;




- -  - -  - -