.


:




:

































 

 

 

 





 

Microsoft Visual Studio 2005 : SDI - MDI -. SDI (). SDI . MDI- , ; . MDI - .

: , . . , , . : . . Close(); ´ .

, SDI , MDI . , SDI . MDI . Microsoft Visual Studio 2005 SDI .

 

4.5.1. SDI

:

- .

- .

- (About).

- .

, .

:

File Windows Help

Quit New About

Open Dialog

 

. (Form2) . 4.4.

 

. 4.4

 

rB1 rB2; cB1 cB2; textBox1. : Hide(); ( , , , ).

. , , .

1. ´. ControlBox False. . . ( ) .

2. , . private ( Form2). Modifiers public.

3. : StartPosition Manual Location X Y . , .

4. :

- Form2 f2; .

- Form1

public Form1()

{

InitializeComponent();

f2 = new Form2();

F2.Show();

}

5. Open Dialog: f2.Show();

: , , Add New Item, About Box Add. . Label, . Close(); About:

private void aboutToolStripMenuItem_Click(object sender, EventArgs e)

{

AboutBox1 ab1;

ab1 = new AboutBox1();

Ab1.ShowDialog();

}

: ShowDialog() Show()? ShowDialog() , . Show() , .

(Form3) . 4.5. . (Form2). , . Form2:

public Form2 f22;

New:

private void newToolStripMenuItem_Click(object sender, EventArgs e)

{

Form3 f3;

f3 = new Form3();

f3.f22 = f2; //

f3.Show();

}

 

 

. 4.5

 

( /; / ):

private void button2_Click(object sender, EventArgs e)

{

string[] St1Arr;

string r1;

double []x;

double z,sum = 0,pr = 1;

r1 = textBox1.Text;

St1Arr = r1.Split(';');

x = new double[St1Arr.Length];

z=Convert.ToDouble(f22.textBox1.Text);

for (int i = 0; i < x.Length; i++)

x[i] = Convert.ToDouble(St1Arr[i]);

if (f22.cB1.Checked)

// ,

{

for (int i = 0; i < x.Length; i++)

{

if (f22.rB1.Checked && x[i] >= z) sum += x[i];

if (f22.rB2.Checked && x[i] < z) sum += x[i];

}

}

if (f22.cB2.Checked) //

{

for (int i = 0; i < x.Length; i++)

{

if (f22.rB1.Checked && x[i] >= z) pr*= x[i];

if (f22.rB2.Checked && x[i] < z) pr*= x[i];

}

}

label3.Text = "" + sum;

label5.Text = "" + pr;

}

 

 

4.5.2. MDI

 

MDI . Form1 , IsMdiContainer True. , , . . :

- .

- .

- .

- , .

- , .

: , ! :

 

.

, . ( , , , MDI ). , , , - . . . 4.6.

 

. 4.6

 

, rB1, rB2, cB1, cB2, tB1. ( Modifiers) public. CANCEL () . :

- .

- .

- , , .

 

, , ( Form1) :

static public int rgi;//

static public Boolean b1,b2;//

static public string s1; //

public , . static .

Load ( ) :

private void Form1_Load(object sender, EventArgs e)

{

rgi = 0;

b1 = false;

b2 = true;

s1 = "I love Moscow";

}

( ):

private void ToolStripMenuItem_Click(object sender, EventArgs e)

{

Form2 f2;

f2 = new Form2();

Switch(rgi)

{ case 0:

f2.rB1.Checked=true;

Break;

case 1:

f2.rB2.Checked=true;

Break;

}

f2.cB1.Checked = b1;

f2.cB2.Checked = b2;

f2.tB1.Text = s1;

F2.ShowDialog();

}

 

, .

CANCEL: Close();

OK: .

private void button1_Click(object sender, EventArgs e)

{

Form1.s1 = tB1.Text;

Form1.b1 = cB1.Checked;

Form1.b2 = cB2.Checked;

if (rB1.Checked) Form1.rgi = 0;

else Form1.rgi = 1;

Close();

}

 

. 4.7.

 

 

 

. 4.7

 

( ):

private void ToolStripMenuItem_Click(object sender, EventArgs e)

{

Form3 f3;

f3 = new Form3();

f3.MdiParent = this; // ,

// ,

f3.label1.Text = s1;

F3.Show();

}

. ShowDialog !

private void ToolStripMenuItem_Click(object sender, EventArgs e)

{

this.LayoutMdi(MdiLayout.Cascade); //

}

 

private void ToolStripMenuItem_Click(object sender, EventArgs e)

{ //





:


: 2016-11-24; !; : 1057 |


:

:

! . .
==> ...

1670 - | 1463 -


© 2015-2024 lektsii.org - -

: 0.032 .